Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: src/codec/SkPngCodec.cpp

Issue 2277903002: SkPngCodec: voidp instead of forward-declares for png.h types. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/codec/SkPngCodec.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } else { 770 } else {
771 *outCodec = new SkPngInterlacedCodec(encodedInfo, imageInfo, stream, 771 *outCodec = new SkPngInterlacedCodec(encodedInfo, imageInfo, stream,
772 chunkReader, png_ptr, info_ptr, bitDepth, numberPasses); 772 chunkReader, png_ptr, info_ptr, bitDepth, numberPasses);
773 } 773 }
774 } 774 }
775 775
776 return true; 776 return true;
777 } 777 }
778 778
779 SkPngCodec::SkPngCodec(const SkEncodedInfo& encodedInfo, const SkImageInfo& imag eInfo, 779 SkPngCodec::SkPngCodec(const SkEncodedInfo& encodedInfo, const SkImageInfo& imag eInfo,
780 SkStream* stream, SkPngChunkReader* chunkReader, png_stru ctp png_ptr, 780 SkStream* stream, SkPngChunkReader* chunkReader, void* pn g_ptr,
781 png_infop info_ptr, int bitDepth, int numberPasses) 781 void* info_ptr, int bitDepth, int numberPasses)
782 : INHERITED(encodedInfo, imageInfo, stream) 782 : INHERITED(encodedInfo, imageInfo, stream)
783 , fPngChunkReader(SkSafeRef(chunkReader)) 783 , fPngChunkReader(SkSafeRef(chunkReader))
784 , fPng_ptr(png_ptr) 784 , fPng_ptr(png_ptr)
785 , fInfo_ptr(info_ptr) 785 , fInfo_ptr(info_ptr)
786 , fSwizzlerSrcRow(nullptr) 786 , fSwizzlerSrcRow(nullptr)
787 , fColorXformSrcRow(nullptr) 787 , fColorXformSrcRow(nullptr)
788 , fSrcRowBytes(imageInfo.width() * (bytes_per_pixel(this->getEncodedInfo().b itsPerPixel()))) 788 , fSrcRowBytes(imageInfo.width() * (bytes_per_pixel(this->getEncodedInfo().b itsPerPixel())))
789 , fNumberPasses(numberPasses) 789 , fNumberPasses(numberPasses)
790 , fBitDepth(bitDepth) 790 , fBitDepth(bitDepth)
791 {} 791 {}
792 792
793 SkPngCodec::~SkPngCodec() { 793 SkPngCodec::~SkPngCodec() {
794 this->destroyReadStruct(); 794 this->destroyReadStruct();
795 } 795 }
796 796
797 void SkPngCodec::destroyReadStruct() { 797 void SkPngCodec::destroyReadStruct() {
798 if (fPng_ptr) { 798 if (fPng_ptr) {
799 // We will never have a nullptr fInfo_ptr with a non-nullptr fPng_ptr 799 // We will never have a nullptr fInfo_ptr with a non-nullptr fPng_ptr
800 SkASSERT(fInfo_ptr); 800 SkASSERT(fInfo_ptr);
801 png_destroy_read_struct(&fPng_ptr, &fInfo_ptr, nullptr); 801 png_destroy_read_struct((png_struct**)&fPng_ptr, (png_info**)&fInfo_ptr, nullptr);
802 fPng_ptr = nullptr; 802 fPng_ptr = nullptr;
803 fInfo_ptr = nullptr; 803 fInfo_ptr = nullptr;
804 } 804 }
805 } 805 }
806 806
807 /////////////////////////////////////////////////////////////////////////////// 807 ///////////////////////////////////////////////////////////////////////////////
808 // Getting the pixels 808 // Getting the pixels
809 /////////////////////////////////////////////////////////////////////////////// 809 ///////////////////////////////////////////////////////////////////////////////
810 810
811 bool SkPngCodec::initializeXforms(const SkImageInfo& dstInfo, const Options& opt ions, 811 bool SkPngCodec::initializeXforms(const SkImageInfo& dstInfo, const Options& opt ions,
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 SkCodec* outCodec; 926 SkCodec* outCodec;
927 if (read_header(stream, chunkReader, &outCodec, nullptr, nullptr)) { 927 if (read_header(stream, chunkReader, &outCodec, nullptr, nullptr)) {
928 // Codec has taken ownership of the stream. 928 // Codec has taken ownership of the stream.
929 SkASSERT(outCodec); 929 SkASSERT(outCodec);
930 streamDeleter.release(); 930 streamDeleter.release();
931 return outCodec; 931 return outCodec;
932 } 932 }
933 933
934 return nullptr; 934 return nullptr;
935 } 935 }
OLDNEW
« no previous file with comments | « src/codec/SkPngCodec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698