Chromium Code Reviews| 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() != |