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

Unified Diff: src/codec/SkPngCodec.cpp

Issue 2009813003: Assign sRGB color space to unmarked jpegs and pngs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkPngCodec.cpp
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 84d25752250c0bc37b40cca9f39df2f9dfa73817..43d1580c176b0b0cfff9b3fda103fd6627f0b765 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -608,6 +608,11 @@ static bool read_header(SkStream* stream, SkPngChunkReader* chunkReader, SkCodec
if (outCodec) {
sk_sp<SkColorSpace> colorSpace = read_color_space(png_ptr, info_ptr);
+ if (!colorSpace) {
+ // Treat unmarked pngs as sRGB.
+ colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
+ }
+
SkEncodedInfo info = SkEncodedInfo::Make(color, alpha, 8);
if (1 == numberPasses) {
« no previous file with comments | « src/codec/SkJpegCodec.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698