Index: third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h |
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h |
index dab65eeb322e1bb5012ec6a6ebc0e908cc363d5e..8628898c2e0b1b19fbe9e44aebd1ff32f0be2161 100644 |
--- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h |
+++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h |
@@ -17,28 +17,34 @@ class WebGraphicsContext3DProvider; |
class PLATFORM_EXPORT StaticBitmapImage : public Image { |
public: |
- ~StaticBitmapImage() override; |
- |
- bool currentFrameIsComplete() override { return true; } |
- |
static PassRefPtr<StaticBitmapImage> create(sk_sp<SkImage>); |
- void destroyDecodedData() override {} |
- bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override; |
- IntSize size() const override; |
+ |
+ // Methods overrided by all sub-classes |
+ virtual ~StaticBitmapImage() {} |
+ bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) = 0; |
+ sk_sp<SkImage> imageForCurrentFrame() = 0; |
+ bool isTextureBacked() = 0; |
void draw(SkCanvas*, |
const SkPaint&, |
const FloatRect& dstRect, |
const FloatRect& srcRect, |
RespectImageOrientationEnum, |
- ImageClampingMode) override; |
+ ImageClampingMode) = 0; |
+ virtual bool originClean() const = 0; |
+ virtual void setOriginClean(bool flag) = 0; |
+ virtual bool isPremultiplied() const = 0; |
+ virtual void setPremultiplied(bool flag) = 0; |
- sk_sp<SkImage> imageForCurrentFrame() override; |
+ // Methods have common implementation for all sub-classes |
+ bool currentFrameIsComplete() override { return true; } |
+ void destroyDecodedData() {} |
+ |
+ // Methods that have a default implementation, and overrided by only one |
+ // sub-class |
+ virtual bool hasMailbox() { return false; } |
+ virtual void transfer() {} |
- bool originClean() const { return m_isOriginClean; } |
- void setOriginClean(bool flag) { m_isOriginClean = flag; } |
- bool isPremultiplied() const { return m_isPremultiplied; } |
- void setPremultiplied(bool flag) { m_isPremultiplied = flag; } |
- bool isTextureBacked() override; |
+ // Methods overrided by AcceleratedStaticBitmapImage only |
virtual void copyToTexture(WebGraphicsContext3DProvider*, |
GLuint, |
GLenum, |
@@ -46,23 +52,25 @@ class PLATFORM_EXPORT StaticBitmapImage : public Image { |
bool) { |
NOTREACHED(); |
} |
- virtual bool hasMailbox() { return false; } |
- virtual void transfer() {} |
- |
- virtual gpu::Mailbox getMailbox() { return gpu::Mailbox(); } |
- virtual gpu::SyncToken getSyncToken() { return gpu::SyncToken(); } |
- virtual void ensureMailbox() {} |
+ virtual void ensureMailbox() { NOTREACHED(); } |
+ virtual gpu::Mailbox mailbox() { |
+ NOTREACHED(); |
+ return gpu::Mailbox(); |
+ } |
+ virtual gpu::SyncToken syncToken() { |
+ NOTREACHED(); |
+ return gpu::SyncToken(); |
+ } |
+ virtual void updateSyncToken(gpu::SyncToken) { NOTREACHED(); } |
protected: |
- StaticBitmapImage(sk_sp<SkImage>); |
- StaticBitmapImage(); // empty constructor for derived class. |
- sk_sp<SkImage> m_image; |
- |
- private: |
- bool m_isOriginClean = true; |
- // The premultiply info is stored here because the SkImage API |
- // doesn't expose this info. |
- bool m_isPremultiplied = true; |
+ // Helper for sub-classes |
+ void drawHelper(SkCanvas*, |
+ const SkPaint&, |
+ const FloatRect&, |
+ const FloatRect&, |
+ ImageClampingMode, |
+ sk_sp<SkImage>); |
}; |
} // namespace blink |