Index: third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp |
diff --git a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp |
index c0b8473ad2761eb0f553341e829d2b1d22992c5e..6141f2187b6aa1ac951c414ca2cbec52fb857eb0 100644 |
--- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp |
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp |
@@ -216,8 +216,7 @@ void PNGImageDecoder::headerAvailable() |
if (colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA) |
png_set_gray_to_rgb(png); |
-#if USE(QCMSLIB) |
- if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreGammaAndColorProfile) { |
+ if ((colorType & PNG_COLOR_MASK_COLOR)) { |
// We only support color profiles for color PALETTE and RGB[A] PNG. Supporting |
// color profiles for gray-scale images is slightly tricky, at least using the |
// CoreGraphics ICC library, because we expand gray-scale images to RGB but we |
@@ -227,7 +226,7 @@ void PNGImageDecoder::headerAvailable() |
bool imageHasAlpha = (colorType & PNG_COLOR_MASK_ALPHA) || trnsCount; |
#ifdef PNG_iCCP_SUPPORTED |
if (png_get_valid(png, info, PNG_INFO_sRGB)) { |
- setColorProfileAndTransform(nullptr, 0, imageHasAlpha, true /* useSRGB */); |
+ setColorProfileAndComputeTransform(nullptr, 0, imageHasAlpha, true /* useSRGB */); |
} else { |
char* profileName = nullptr; |
int compressionType = 0; |
@@ -238,19 +237,18 @@ void PNGImageDecoder::headerAvailable() |
#endif |
png_uint_32 profileLength = 0; |
if (png_get_iCCP(png, info, &profileName, &compressionType, &profile, &profileLength)) { |
- setColorProfileAndTransform(reinterpret_cast<char*>(profile), profileLength, imageHasAlpha, false /* useSRGB */); |
+ setColorProfileAndComputeTransform(reinterpret_cast<char*>(profile), profileLength, imageHasAlpha, false /* useSRGB */); |
} |
} |
#endif // PNG_iCCP_SUPPORTED |
} |
-#endif // USE(QCMSLIB) |
if (!hasColorProfile()) { |
// Deal with gamma and keep it under our control. |
const double inverseGamma = 0.45455; |
const double defaultGamma = 2.2; |
double gamma; |
- if (!m_ignoreGammaAndColorProfile && png_get_gAMA(png, info, &gamma)) { |
+ if (png_get_gAMA(png, info, &gamma)) { |
const double maxGamma = 21474.83; |
if ((gamma <= 0.0) || (gamma > maxGamma)) { |
gamma = inverseGamma; |
@@ -294,7 +292,7 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, |
ImageFrame& buffer = m_frameBufferCache[0]; |
if (buffer.getStatus() == ImageFrame::FrameEmpty) { |
png_structp png = m_reader->pngPtr(); |
- if (!buffer.setSize(size().width(), size().height())) { |
+ if (!buffer.setSizeAndColorProfile(size().width(), size().height(), colorProfile())) { |
longjmp(JMPBUF(png), 1); |
return; |
} |