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

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: DCHECK m_status in ImageFrame. Shortened commit message. Thanks kbr@. Created 4 years, 3 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..13f080231a89c77cbf9acbab8562868936c0ce0b 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageFrame.h
@@ -32,6 +32,7 @@
#include "public/platform/WebVector.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColorPriv.h"
+#include "third_party/skia/include/core/SkImage.h"
#include "wtf/Allocator.h"
#include "wtf/Assertions.h"
#include "wtf/PassRefPtr.h"
@@ -97,6 +98,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 +131,15 @@ public:
AlphaBlendSource getAlphaBlendSource() const { return m_alphaBlendSource; }
bool premultiplyAlpha() const { return m_premultiplyAlpha; }
SkBitmap::Allocator* allocator() const { return m_allocator; }
+
+ // Returns the bitmap that is the output of decoding.
const SkBitmap& bitmap() const { return m_bitmap; }
+
+ // Create SkImage from bitmap() and return it. This should be called only
+ // if frame is complete. The bitmap is set immutable before creating
+ // SkImage to avoid copying bitmap in SkImage::MakeFromBitmap(m_bitmap).
+ sk_sp<SkImage> finalizePixelsAndGetImage();
+
// 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