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

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

Issue 1667823004: Set sRGB flag for PNGs with an sRGB chunk (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Created 4 years, 10 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/SkCodecPriv.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 "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkColorTable.h" 10 #include "SkColorTable.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 default: 321 default:
322 // All the color types have been covered above. 322 // All the color types have been covered above.
323 SkASSERT(false); 323 SkASSERT(false);
324 } 324 }
325 325
326 int numberPasses = png_set_interlace_handling(png_ptr); 326 int numberPasses = png_set_interlace_handling(png_ptr);
327 if (numberPassesPtr) { 327 if (numberPassesPtr) {
328 *numberPassesPtr = numberPasses; 328 *numberPassesPtr = numberPasses;
329 } 329 }
330 330
331 // FIXME: Also need to check for sRGB ( https://bug.skia.org/3471 ). 331 SkColorProfileType profileType = kLinear_SkColorProfileType;
332 if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {
333 profileType = kSRGB_SkColorProfileType;
334 }
332 335
333 if (imageInfo) { 336 if (imageInfo) {
334 *imageInfo = SkImageInfo::Make(origWidth, origHeight, colorType, alphaTy pe); 337 *imageInfo = SkImageInfo::Make(origWidth, origHeight, colorType, alphaTy pe, profileType);
335 } 338 }
336 autoClean.detach(); 339 autoClean.detach();
337 if (png_ptrp) { 340 if (png_ptrp) {
338 *png_ptrp = png_ptr; 341 *png_ptrp = png_ptr;
339 } 342 }
340 if (info_ptrp) { 343 if (info_ptrp) {
341 *info_ptrp = info_ptr; 344 *info_ptrp = info_ptr;
342 } 345 }
343 346
344 return true; 347 return true;
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 } 766 }
764 767
765 if (1 == numberPasses) { 768 if (1 == numberPasses) {
766 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk Reader, 769 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk Reader,
767 png_ptr, info_ptr, bitDepth); 770 png_ptr, info_ptr, bitDepth);
768 } 771 }
769 772
770 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader, 773 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader,
771 png_ptr, info_ptr, bitDepth, numbe rPasses); 774 png_ptr, info_ptr, bitDepth, numbe rPasses);
772 } 775 }
OLDNEW
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698