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

Unified Diff: third_party/WebKit/Source/platform/exported/WebImage.cpp

Issue 2155973002: Save a bitmap copy when advancing to dependent GIF and WebP animation frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: finalizePixelsAndGetImage. Created 4 years, 4 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/exported/WebImage.cpp
diff --git a/third_party/WebKit/Source/platform/exported/WebImage.cpp b/third_party/WebKit/Source/platform/exported/WebImage.cpp
index d4b14e300c3491b823cb21bf9e03749feae2f3f4..526893d3406496c3ea8d348bf012d6e935580292 100644
--- a/third_party/WebKit/Source/platform/exported/WebImage.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebImage.cpp
@@ -78,10 +78,13 @@ WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize)
}
ImageFrame* frame = decoder->frameBufferAtIndex(index);
- if (!frame)
+ if (!frame || decoder->failed())
return WebImage();
- return WebImage(frame->bitmap());
+ DCHECK_EQ(frame->getStatus(), ImageFrame::FrameComplete);
+ SkBitmap bitmap = frame->bitmap();
+ bitmap.setImmutable();
+ return WebImage(bitmap);
}
WebVector<WebImage> WebImage::framesFromData(const WebData& data)
@@ -114,9 +117,11 @@ WebVector<WebImage> WebImage::framesFromData(const WebData& data)
if (!frame)
continue;
- const SkBitmap& bitmap = frame->bitmap();
- if (!bitmap.isNull() && bitmap.isImmutable())
+ SkBitmap bitmap = frame->bitmap();
+ if (!bitmap.isNull() && frame->getStatus() == ImageFrame::FrameComplete) {
+ bitmap.setImmutable();
frames.append(WebImage(bitmap));
+ }
}
return frames;

Powered by Google App Engine
This is Rietveld 408576698