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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp

Issue 2203903002: Color: Read embedded ICC profiles regardless of QCMS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update tests Created 4 years, 4 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
Index: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
index fae908a78e567ec303b4b967a767735cffe0861c..d5e4397de0bc5f453a10d91fe741a2839e21c6b2 100644
--- a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
@@ -231,10 +231,8 @@ bool WEBPImageDecoder::updateDemuxer()
m_formatFlags &= ~ICCP_FLAG;
}
-#if USE(QCMSLIB)
if ((m_formatFlags & ICCP_FLAG) && !ignoresGammaAndColorProfile())
readColorProfile();
-#endif
}
ASSERT(isDecodedSizeAvailable());
@@ -250,7 +248,7 @@ bool WEBPImageDecoder::initFrameBuffer(size_t frameIndex)
const size_t requiredPreviousFrameIndex = buffer.requiredPreviousFrameIndex();
if (requiredPreviousFrameIndex == kNotFound) {
// This frame doesn't rely on any previous data.
- if (!buffer.setSize(size().width(), size().height()))
+ if (!buffer.setSizeAndColorProfile(size().width(), size().height(), colorProfile()))
return setFailed();
m_frameBackgroundHasAlpha = !buffer.originalFrameRect().contains(IntRect(IntPoint(), size()));
} else {
@@ -300,8 +298,6 @@ void WEBPImageDecoder::clearFrameBuffer(size_t frameIndex)
ImageDecoder::clearFrameBuffer(frameIndex);
}
-#if USE(QCMSLIB)
-
void WEBPImageDecoder::readColorProfile()
{
WebPChunkIterator chunkIterator;
@@ -313,13 +309,11 @@ void WEBPImageDecoder::readColorProfile()
const char* profileData = reinterpret_cast<const char*>(chunkIterator.chunk.bytes);
size_t profileSize = chunkIterator.chunk.size;
- setColorProfileAndTransform(profileData, profileSize, true /* hasAlpha */, false /* useSRGB */);
+ setColorProfileAndComputeTransform(profileData, profileSize, true /* hasAlpha */, false /* useSRGB */);
WebPDemuxReleaseChunkIterator(&chunkIterator);
}
-#endif // USE(QCMSLIB)
-
void WEBPImageDecoder::applyPostProcessing(size_t frameIndex)
{
ImageFrame& buffer = m_frameBufferCache[frameIndex];
@@ -462,7 +456,7 @@ bool WEBPImageDecoder::decodeSingleFrame(const uint8_t* dataBytes, size_t dataSi
ASSERT(buffer.getStatus() != ImageFrame::FrameComplete);
if (buffer.getStatus() == ImageFrame::FrameEmpty) {
- if (!buffer.setSize(size().width(), size().height()))
+ if (!buffer.setSizeAndColorProfile(size().width(), size().height(), colorProfile()))
return setFailed();
buffer.setStatus(ImageFrame::FramePartial);
// The buffer is transparent outside the decoded area while the image is loading.

Powered by Google App Engine
This is Rietveld 408576698