| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef StaticBitmapImage_h | 5 #ifndef StaticBitmapImage_h |
| 6 #define StaticBitmapImage_h | 6 #define StaticBitmapImage_h |
| 7 | 7 |
| 8 #include "gpu/command_buffer/common/mailbox.h" |
| 9 #include "gpu/command_buffer/common/sync_token.h" |
| 8 #include "platform/graphics/Image.h" | 10 #include "platform/graphics/Image.h" |
| 9 #include "third_party/khronos/GLES2/gl2.h" | 11 #include "third_party/khronos/GLES2/gl2.h" |
| 10 #include "third_party/skia/include/core/SkRefCnt.h" | 12 #include "third_party/skia/include/core/SkRefCnt.h" |
| 11 | 13 |
| 12 namespace blink { | 14 namespace blink { |
| 13 | 15 |
| 14 class WebGraphicsContext3DProvider; | 16 class WebGraphicsContext3DProvider; |
| 15 | 17 |
| 16 class PLATFORM_EXPORT StaticBitmapImage : public Image { | 18 class PLATFORM_EXPORT StaticBitmapImage : public Image { |
| 17 public: | 19 public: |
| 18 ~StaticBitmapImage() override { }; | 20 ~StaticBitmapImage() override; |
| 19 | 21 |
| 20 bool currentFrameIsComplete() override { return true; } | 22 bool currentFrameIsComplete() override { return true; } |
| 21 | 23 |
| 22 static PassRefPtr<StaticBitmapImage> create(sk_sp<SkImage>); | 24 static PassRefPtr<StaticBitmapImage> create(sk_sp<SkImage>); |
| 23 void destroyDecodedData() override { } | 25 void destroyDecodedData() override { } |
| 24 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override
; | 26 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override
; |
| 25 IntSize size() const override; | 27 IntSize size() const override; |
| 26 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe
ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; | 28 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe
ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; |
| 27 | 29 |
| 28 sk_sp<SkImage> imageForCurrentFrame() override; | 30 sk_sp<SkImage> imageForCurrentFrame() override; |
| 29 | 31 |
| 30 bool originClean() const { return m_isOriginClean; } | 32 bool originClean() const { return m_isOriginClean; } |
| 31 void setOriginClean(bool flag) { m_isOriginClean = flag; } | 33 void setOriginClean(bool flag) { m_isOriginClean = flag; } |
| 32 bool isPremultiplied() const { return m_isPremultiplied; } | 34 bool isPremultiplied() const { return m_isPremultiplied; } |
| 33 void setPremultiplied(bool flag) { m_isPremultiplied = flag; } | 35 void setPremultiplied(bool flag) { m_isPremultiplied = flag; } |
| 34 bool isTextureBacked() override; | 36 bool isTextureBacked() override; |
| 35 virtual void copyToTexture(WebGraphicsContext3DProvider*, GLuint, GLenum, GL
enum, bool) { NOTREACHED(); } | 37 virtual void copyToTexture(WebGraphicsContext3DProvider*, GLuint, GLenum, GL
enum, bool) { NOTREACHED(); } |
| 36 virtual bool hasMailbox() { return false; } | 38 virtual bool hasMailbox() { return false; } |
| 37 virtual void transfer() { } | 39 virtual void transfer() { } |
| 38 | 40 |
| 41 virtual gpu::Mailbox getMailbox() { return gpu::Mailbox(); } |
| 42 virtual gpu::SyncToken getSyncToken() { return gpu::SyncToken(); } |
| 43 virtual void ensureMailbox() {} |
| 44 |
| 39 protected: | 45 protected: |
| 40 StaticBitmapImage(sk_sp<SkImage>); | 46 StaticBitmapImage(sk_sp<SkImage>); |
| 41 StaticBitmapImage() { } // empty constructor for derived class. | 47 StaticBitmapImage(); // empty constructor for derived class. |
| 42 sk_sp<SkImage> m_image; | 48 sk_sp<SkImage> m_image; |
| 43 | 49 |
| 44 private: | 50 private: |
| 45 bool m_isOriginClean = true; | 51 bool m_isOriginClean = true; |
| 46 // The premultiply info is stored here because the SkImage API | 52 // The premultiply info is stored here because the SkImage API |
| 47 // doesn't expose this info. | 53 // doesn't expose this info. |
| 48 bool m_isPremultiplied = true; | 54 bool m_isPremultiplied = true; |
| 49 }; | 55 }; |
| 50 | 56 |
| 51 } // namespace blink | 57 } // namespace blink |
| 52 | 58 |
| 53 #endif | 59 #endif |
| OLD | NEW |