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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp

Issue 2756463003: Remove opaque alpha channel special case (Closed)
Patch Set: Fix gif detecting if a frame claims to have transparency Created 3 years, 9 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/gif/GIFImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp
index 307e6a4f93d4c67f6793c152bb4172390813ec37..fb18e1e4f7758cb72c496630811252211e7d9a1d 100644
--- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp
@@ -157,10 +157,8 @@ bool GIFImageDecoder::haveDecodedRow(size_t frameIndex,
if ((sourceValue != transparentPixel) &&
(sourceValue < colorTable.size())) {
*currentAddress = colorTableIter[sourceValue];
- } else {
+ } else
*currentAddress = 0;
- m_currentBufferSawAlpha = true;
- }
}
} else {
for (; rowBegin != rowEnd; ++rowBegin, ++currentAddress) {
@@ -168,8 +166,6 @@ bool GIFImageDecoder::haveDecodedRow(size_t frameIndex,
if ((sourceValue != transparentPixel) &&
(sourceValue < colorTable.size()))
*currentAddress = colorTableIter[sourceValue];
- else
- m_currentBufferSawAlpha = true;
cblume 2017/05/05 00:05:20 I confirmed this line is making a difference and i
}
}
@@ -191,10 +187,13 @@ bool GIFImageDecoder::frameComplete(size_t frameIndex) {
if (!initFrameBuffer(frameIndex))
return setFailed();
- if (!m_currentBufferSawAlpha)
- correctAlphaWhenFrameBufferSawNoAlpha(frameIndex);
+ ImageFrame& buffer = m_frameBufferCache[frameIndex];
+
+ const GIFFrameContext* frameContext = m_reader->frameContext(frameIndex);
+ const size_t transparentPixel = frameContext->transparentPixel();
+ buffer.setHasAlpha(transparentPixel != kNotFound);
- m_frameBufferCache[frameIndex].setStatus(ImageFrame::FrameComplete);
+ buffer.setStatus(ImageFrame::FrameComplete);
return true;
}
@@ -269,10 +268,6 @@ void GIFImageDecoder::parse(GIFParseQuery query) {
setFailed();
}
-void GIFImageDecoder::onInitFrameBuffer(size_t frameIndex) {
- m_currentBufferSawAlpha = false;
-}
-
bool GIFImageDecoder::canReusePreviousFrameBuffer(size_t frameIndex) const {
DCHECK(frameIndex < m_frameBufferCache.size());
return m_frameBufferCache[frameIndex].getDisposalMethod() !=

Powered by Google App Engine
This is Rietveld 408576698