Index: Source/core/platform/image-decoders/png/PNGImageDecoder.cpp |
diff --git a/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp b/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp |
index beb9a1dc8e6ee7c9e0cb688b7b18ca3e0da0c093..ae1735aceab7978f6f66747d2f0cb596b641f7b4 100644 |
--- a/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp |
+++ b/Source/core/platform/image-decoders/png/PNGImageDecoder.cpp |
@@ -488,16 +488,11 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, |
#endif |
// Write the decoded row pixels to the frame buffer. |
- ImageFrame::PixelData* address = buffer.getAddr(0, y); |
bool nonTrivialAlpha = false; |
- int width = size().width(); |
- |
- png_bytep pixel = row; |
- for (int x = 0; x < width; ++x, pixel += colorChannels) { |
- unsigned alpha = hasAlpha ? pixel[3] : 255; |
- buffer.setRGBA(address++, pixel[0], pixel[1], pixel[2], alpha); |
- nonTrivialAlpha |= alpha < 255; |
- } |
+ if (hasAlpha) |
+ buffer.fillRowFromRGBASourceWithNonTrivialAlphaDetection(y, row, nonTrivialAlpha); |
+ else |
+ buffer.fillRowFromRGBSource(y, row); |
if (nonTrivialAlpha && !buffer.hasAlpha()) |
buffer.setHasAlpha(nonTrivialAlpha); |