Chromium Code Reviews| 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..ce175145fce8ff747ec0f05affc813bb7873b702 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. |
|
Peter Kasting
2016/08/30 06:59:40
Nit: Maybe better second sentence: "This fails if
aleksandar.stojiljkovic
2016/09/21 20:56:57
The issue here is not in destructive modification
|
| + 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; } |
| - const SkBitmap& bitmap() const { return m_bitmap; } |
| + |
| + // Returns the bitmap that is the output of decoding. |
| + const SkBitmap& bitmap() const; |
| + |
| + // Create SkImage from bitmap() and return it. If frame is complete, the |
| + // bitmap is set immutable before creating SkImage to avoid copying bitmap |
| + // in SkImage::MakeFromBitmap(m_bitmap). |
| + PassRefPtr<SkImage> finalizePixelsAndGetImage(); |
|
Peter Kasting
2016/08/30 06:59:40
Given that this doesn't always finalize the pixels
aleksandar.stojiljkovic
2016/09/21 20:56:57
I like finalizePixelsAndGetImage as it explains wh
|
| + |
| // 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; } |