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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp

Issue 1972683002: Early reporting of opaqueness by decoders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/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 bff97c205e1780f9f60392caac16f80acff9d86d..993b1b6fbb10c24e549eed3e4e70689416661251 100644
--- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -92,7 +92,7 @@ public:
, m_readOffset(readOffset)
, m_currentBufferSize(0)
, m_decodingSizeOnly(false)
- , m_hasAlpha(false)
+ , m_hasAlpha(true)
#if USE(QCMSLIB)
, m_rowBuffer()
#endif
@@ -170,6 +170,13 @@ PNGImageDecoder::~PNGImageDecoder()
{
}
+bool PNGImageDecoder::frameHasAlphaAtIndex(size_t index) const
+{
+ if (index == 0 && isAllDataReceived() && m_reader && !m_reader->hasAlpha())
+ return false;
+ return ImageDecoder::frameHasAlphaAtIndex(index);
+}
+
void PNGImageDecoder::headerAvailable()
{
png_structp png = m_reader->pngPtr();

Powered by Google App Engine
This is Rietveld 408576698