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

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

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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/SkJpegCodec.cpp ('k') | src/codec/SkWbmpCodec.cpp » ('j') | 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 png_infopp info_pp = fInfo_ptr ? &fInfo_ptr : nullptr; 68 png_infopp info_pp = fInfo_ptr ? &fInfo_ptr : nullptr;
69 png_destroy_read_struct(&fPng_ptr, info_pp, nullptr); 69 png_destroy_read_struct(&fPng_ptr, info_pp, nullptr);
70 } 70 }
71 } 71 }
72 72
73 void setInfoPtr(png_infop info_ptr) { 73 void setInfoPtr(png_infop info_ptr) {
74 SkASSERT(nullptr == fInfo_ptr); 74 SkASSERT(nullptr == fInfo_ptr);
75 fInfo_ptr = info_ptr; 75 fInfo_ptr = info_ptr;
76 } 76 }
77 77
78 void detach() { 78 void release() {
79 fPng_ptr = nullptr; 79 fPng_ptr = nullptr;
80 fInfo_ptr = nullptr; 80 fInfo_ptr = nullptr;
81 } 81 }
82 82
83 private: 83 private:
84 png_structp fPng_ptr; 84 png_structp fPng_ptr;
85 png_infop fInfo_ptr; 85 png_infop fInfo_ptr;
86 }; 86 };
87 #define AutoCleanPng(...) SK_REQUIRE_LOCAL_VAR(AutoCleanPng) 87 #define AutoCleanPng(...) SK_REQUIRE_LOCAL_VAR(AutoCleanPng)
88 88
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 407 }
408 408
409 SkColorProfileType profileType = kLinear_SkColorProfileType; 409 SkColorProfileType profileType = kLinear_SkColorProfileType;
410 if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) { 410 if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {
411 profileType = kSRGB_SkColorProfileType; 411 profileType = kSRGB_SkColorProfileType;
412 } 412 }
413 413
414 if (imageInfo) { 414 if (imageInfo) {
415 *imageInfo = SkImageInfo::Make(origWidth, origHeight, colorType, alphaTy pe, profileType); 415 *imageInfo = SkImageInfo::Make(origWidth, origHeight, colorType, alphaTy pe, profileType);
416 } 416 }
417 autoClean.detach(); 417 autoClean.release();
418 if (png_ptrp) { 418 if (png_ptrp) {
419 *png_ptrp = png_ptr; 419 *png_ptrp = png_ptr;
420 } 420 }
421 if (info_ptrp) { 421 if (info_ptrp) {
422 *info_ptrp = info_ptr; 422 *info_ptrp = info_ptr;
423 } 423 }
424 424
425 return true; 425 return true;
426 } 426 }
427 427
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 int numberPasses; 834 int numberPasses;
835 835
836 if (!read_header(stream, chunkReader, &png_ptr, &info_ptr, &imageInfo, &bitD epth, 836 if (!read_header(stream, chunkReader, &png_ptr, &info_ptr, &imageInfo, &bitD epth,
837 &numberPasses)) { 837 &numberPasses)) {
838 return nullptr; 838 return nullptr;
839 } 839 }
840 840
841 auto colorSpace = read_color_space(png_ptr, info_ptr); 841 auto colorSpace = read_color_space(png_ptr, info_ptr);
842 842
843 if (1 == numberPasses) { 843 if (1 == numberPasses) {
844 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk Reader, 844 return new SkPngScanlineDecoder(imageInfo, streamDeleter.release(), chun kReader,
845 png_ptr, info_ptr, bitDepth, colorSpace) ; 845 png_ptr, info_ptr, bitDepth, colorSpace) ;
846 } 846 }
847 847
848 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader, 848 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.release() , chunkReader,
849 png_ptr, info_ptr, bitDepth, numbe rPasses, 849 png_ptr, info_ptr, bitDepth, numbe rPasses,
850 colorSpace); 850 colorSpace);
851 } 851 }
OLDNEW
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | src/codec/SkWbmpCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698