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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageFrame.h

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: +webp. fix test failures. 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/image-decoders/ImageFrame.h
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h
index 3541f7dcc1eef4f979dc05d574220a55a52d69d7..247cd8eb2365aa8755ba8eb992c90ee341832c50 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h
@@ -97,6 +97,11 @@ public:
// the other. Returns whether the copy succeeded.
bool copyBitmapData(const ImageFrame&);
+ // Moves the bitmap data from the provided frame to this one, leaving the
+ // provided frame empty. Operation is successful only if bitmap data is not
+ // marked as done (immutable). Returns whether the move succeeded.
+ bool takeBitmapDataIfWritable(ImageFrame*);
+
// Copies the pixel data at [(startX, startY), (endX, startY)) to the
// same X-coordinates on each subsequent row up to but not including
// endY.
@@ -125,7 +130,15 @@ public:
AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; }
bool premultiplyAlpha() const { return m_premultiplyAlpha; }
SkBitmap::Allocator* allocator() const { return m_allocator; }
- const SkBitmap& bitmap() const { return m_bitmap; }
+
+ // Returns the bitmap that is the output of decoding.
+ // If the decoding is complete, sets the bitmap status to immutable if
+ // |setImmutableIfDone| is true.
+ // When |setImmutableIfDone| is false, bitmap is not sealed before returned
+ // and that enables optimization - saving a bitmap copy per frame when
+ // decoding animations. See also takeBitmapDataIfWritable.
Peter Kasting 2016/08/26 19:04:04 As a reader, I'm wondering why we would ever want
aleksandar.stojiljkovic 2016/08/26 21:53:51 It is convenient that bitmap carry information abo
Peter Kasting 2016/08/27 04:19:58 What does "taking it a step back for one of the cl
aleksandar.stojiljkovic 2016/08/28 08:58:31 That sentence could be ignored - it just means tha
+ const SkBitmap& bitmap(bool setImmutableIfDone = true);
Peter Kasting 2016/08/26 19:04:04 Nit: This is named like a simple accessor, but it
aleksandar.stojiljkovic 2016/08/26 21:53:51 It would be clear if we have additional accessor t
Peter Kasting 2016/08/27 04:19:58 That second function still looks like a cheap acce
aleksandar.stojiljkovic 2016/08/28 08:58:31 Done. bitmap() is back to original "cheap accessor
+
// Returns true if the pixels changed, but the bitmap has not yet been notified.
bool pixelsChanged() const { return m_pixelsChanged; }
size_t requiredPreviousFrameIndex() const { return m_requiredPreviousFrameIndex; }

Powered by Google App Engine
This is Rietveld 408576698