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

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

Issue 2756463003: Remove opaque alpha channel special case (Closed)
Patch Set: 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/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 cb37d138bd29caa3860fdbdb00875b763aa4a2d3..49a11b7dc51f1cccd0d476cf29d12b944fc5d163 100644
--- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -51,8 +51,7 @@ PNGImageDecoder::PNGImageDecoder(AlphaOption alphaOption,
// that as a signal to never check again, meaning the actual count will
// never be respected.
m_repetitionCount(cAnimationLoopOnce),
- m_hasAlphaChannel(false),
- m_currentBufferSawAlpha(false) {}
+ m_hasAlphaChannel(false) {}
PNGImageDecoder::~PNGImageDecoder() {}
@@ -300,8 +299,6 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer,
return;
}
}
-
- m_currentBufferSawAlpha = false;
}
const IntRect& frameRect = buffer.originalFrameRect();
@@ -389,7 +386,6 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer,
srcPtr = png_bytep(dstRow);
}
- unsigned alphaMask = 255;
if (m_frameBufferCache[m_currentFrame].getAlphaBlendSource() ==
ImageFrame::BlendAtopBgcolor) {
if (buffer.premultiplyAlpha()) {
@@ -397,14 +393,12 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer,
dstPixel++, srcPtr += 4) {
buffer.setRGBAPremultiply(dstPixel, srcPtr[0], srcPtr[1], srcPtr[2],
srcPtr[3]);
- alphaMask &= srcPtr[3];
}
} else {
for (auto *dstPixel = dstRow; dstPixel < dstRow + width;
dstPixel++, srcPtr += 4) {
buffer.setRGBARaw(dstPixel, srcPtr[0], srcPtr[1], srcPtr[2],
srcPtr[3]);
- alphaMask &= srcPtr[3];
}
}
} else {
@@ -417,21 +411,15 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer,
dstPixel++, srcPtr += 4) {
buffer.blendRGBAPremultiplied(dstPixel, srcPtr[0], srcPtr[1],
srcPtr[2], srcPtr[3]);
- alphaMask &= srcPtr[3];
}
} else {
for (auto *dstPixel = dstRow; dstPixel < dstRow + width;
dstPixel++, srcPtr += 4) {
buffer.blendRGBARaw(dstPixel, srcPtr[0], srcPtr[1], srcPtr[2],
srcPtr[3]);
- alphaMask &= srcPtr[3];
}
}
}
-
- if (alphaMask != 255)
- m_currentBufferSawAlpha = true;
-
} else {
for (auto *dstPixel = dstRow; dstPixel < dstRow + width;
srcPtr += 3, ++dstPixel) {
@@ -463,9 +451,6 @@ void PNGImageDecoder::frameComplete() {
return;
}
- if (!m_currentBufferSawAlpha)
- correctAlphaWhenFrameBufferSawNoAlpha(m_currentFrame);
-
buffer.setStatus(ImageFrame::FrameComplete);
}

Powered by Google App Engine
This is Rietveld 408576698