aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkPngCodec.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-02-04 15:37:58 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-04 15:37:58 -0800
commita87d6de6a5018eab0a484af510338601f2976772 (patch)
tree523a4e97ad1cf511e05ef2e3283b15fa472bc9a4 /src/codec/SkPngCodec.cpp
parent16aad786023e4cfa338b42a5f35d4f885defb789 (diff)
Set sRGB flag for PNGs with an sRGB chunk
Diffstat (limited to 'src/codec/SkPngCodec.cpp')
-rw-r--r--src/codec/SkPngCodec.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 232373c044..656df7da0b 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -328,10 +328,13 @@ static bool read_header(SkStream* stream, SkPngChunkReader* chunkReader,
*numberPassesPtr = numberPasses;
}
- // FIXME: Also need to check for sRGB ( https://bug.skia.org/3471 ).
+ SkColorProfileType profileType = kLinear_SkColorProfileType;
+ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {
+ profileType = kSRGB_SkColorProfileType;
+ }
if (imageInfo) {
- *imageInfo = SkImageInfo::Make(origWidth, origHeight, colorType, alphaType);
+ *imageInfo = SkImageInfo::Make(origWidth, origHeight, colorType, alphaType, profileType);
}
autoClean.detach();
if (png_ptrp) {