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

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

Issue 2749703002: Refactor ImageFrame::setSizeAndColorSpace() (Closed)
Patch Set: Forgot to update the call sites 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 6deba9ce22adfd250319cac12dada224f706df3d..c06abd69305a37023f09209fda9c11f86126739e 100644
--- a/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/png/PNGImageDecoder.cpp
@@ -206,12 +206,14 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer,
ImageFrame& buffer = m_frameBufferCache[0];
if (buffer.getStatus() == ImageFrame::FrameEmpty) {
png_structp png = m_reader->pngPtr();
- if (!buffer.setSizeAndColorSpace(size().width(), size().height(),
+ if (!buffer.allocateBackingStore(size().width(), size().height(),
colorSpaceForSkImages())) {
longjmp(JMPBUF(png), 1);
return;
}
+ buffer.zeroFillPixelData();
+
unsigned colorChannels = m_reader->hasAlpha() ? 4 : 3;
if (PNG_INTERLACE_ADAM7 ==
png_get_interlace_type(png, m_reader->infoPtr())) {

Powered by Google App Engine
This is Rietveld 408576698