OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |