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 5f787b50ea0044779301c303903b7c7591902ef3..008852e71d0898a0807234e843b61f8a276b6386 100644 |
--- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp |
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp |
@@ -163,6 +163,7 @@ private: |
PNGImageDecoder::PNGImageDecoder(AlphaOption alphaOption, GammaAndColorProfileOption colorOptions, size_t maxDecodedBytes, size_t offset) |
: ImageDecoder(alphaOption, colorOptions, maxDecodedBytes) |
, m_offset(offset) |
+ , m_hasPixelsWithAlpha(false) |
{ |
} |
@@ -314,7 +315,6 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, |
} |
#endif |
buffer.setStatus(ImageFrame::FramePartial); |
scroggo_chromium
2016/05/16 20:32:08
Previously, a partially decoded PNG file will repo
|
- buffer.setHasAlpha(false); |
// For PNGs, the frame always fills the entire image. |
buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); |
@@ -401,8 +401,8 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, |
} |
} |
- if (alphaMask != 255 && !buffer.hasAlpha()) |
- buffer.setHasAlpha(true); |
+ if (alphaMask != 255 && !m_hasPixelsWithAlpha) |
+ m_hasPixelsWithAlpha = true; |
buffer.setPixelsChanged(true); |
} |
@@ -412,21 +412,18 @@ void PNGImageDecoder::complete() |
if (m_frameBufferCache.isEmpty()) |
return; |
+ m_frameBufferCache[0].setHasAlpha(m_hasPixelsWithAlpha); |
m_frameBufferCache[0].setStatus(ImageFrame::FrameComplete); |
} |
-inline bool isComplete(const PNGImageDecoder* decoder) |
-{ |
- return decoder->frameIsCompleteAtIndex(0); |
-} |
- |
void PNGImageDecoder::decode(bool onlySize) |
{ |
if (failed()) |
return; |
- if (!m_reader) |
+ if (!m_reader) { |
scroggo_chromium
2016/05/16 20:32:08
This change is unnecessary.
aleksandar.stojiljkovic
2016/05/22 15:41:53
Done.
|
m_reader = adoptPtr(new PNGImageReader(this, m_offset)); |
+ } |
// If we couldn't decode the image but have received all the data, decoding |
// has failed. |
@@ -434,7 +431,7 @@ void PNGImageDecoder::decode(bool onlySize) |
setFailed(); |
// If decoding is done or failed, we don't need the PNGImageReader anymore. |
- if (isComplete(this) || failed()) |
+ if (frameIsCompleteAtIndex(0) || failed()) |
m_reader.clear(); |
} |