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

Unified Diff: Source/platform/image-decoders/png/PNGImageDecoder.cpp

Issue 765223002: Ignore PNG gamma chunk when PNG images have a color profile (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 | « LayoutTests/fast/images/resources/png-color-profile-and-gamma-chunk.png ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/image-decoders/png/PNGImageDecoder.cpp
diff --git a/Source/platform/image-decoders/png/PNGImageDecoder.cpp b/Source/platform/image-decoders/png/PNGImageDecoder.cpp
index 0af0d853df784a72520b8ca05335c58bc25fe694..ad2cae077181335926b77fbfe57f3c7dee3ad011 100644
--- a/Source/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/Source/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -371,16 +371,19 @@ void PNGImageDecoder::headerAvailable()
}
#endif
- // Deal with gamma and keep it under our control.
- double gamma;
- if (!m_ignoreGammaAndColorProfile && png_get_gAMA(png, info, &gamma)) {
- if ((gamma <= 0.0) || (gamma > cMaxGamma)) {
- gamma = cInverseGamma;
- png_set_gAMA(png, info, gamma);
+ if (!m_hasColorProfile) {
+ // Deal with gamma and keep it under our control.
+ double gamma;
+ if (!m_ignoreGammaAndColorProfile && png_get_gAMA(png, info, &gamma)) {
+ if ((gamma <= 0.0) || (gamma > cMaxGamma)) {
+ gamma = cInverseGamma;
+ png_set_gAMA(png, info, gamma);
+ }
+ png_set_gamma(png, cDefaultGamma, gamma);
+ } else {
+ png_set_gamma(png, cDefaultGamma, cInverseGamma);
}
- png_set_gamma(png, cDefaultGamma, gamma);
- } else
- png_set_gamma(png, cDefaultGamma, cInverseGamma);
+ }
// Tell libpng to send us rows for interlaced pngs.
if (interlaceType == PNG_INTERLACE_ADAM7)
« no previous file with comments | « LayoutTests/fast/images/resources/png-color-profile-and-gamma-chunk.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698