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 "platform/graphics/Image.h" | 8 #include "platform/graphics/Image.h" |
9 #include "third_party/khronos/GLES2/gl2.h" | 9 #include "third_party/khronos/GLES2/gl2.h" |
| 10 #include "third_party/skia/include/core/SkRefCnt.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 class WebGraphicsContext3DProvider; | 14 class WebGraphicsContext3DProvider; |
14 | 15 |
15 class PLATFORM_EXPORT StaticBitmapImage : public Image { | 16 class PLATFORM_EXPORT StaticBitmapImage : public Image { |
16 public: | 17 public: |
17 ~StaticBitmapImage() override { }; | 18 ~StaticBitmapImage() override { }; |
18 | 19 |
19 bool currentFrameIsComplete() override { return true; } | 20 bool currentFrameIsComplete() override { return true; } |
20 | 21 |
21 static PassRefPtr<StaticBitmapImage> create(PassRefPtr<SkImage>); | 22 static PassRefPtr<StaticBitmapImage> create(sk_sp<SkImage>); |
22 void destroyDecodedData() override { } | 23 void destroyDecodedData() override { } |
23 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override
; | 24 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override
; |
24 IntSize size() const override; | 25 IntSize size() const override; |
25 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe
ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; | 26 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe
ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; |
26 | 27 |
27 PassRefPtr<SkImage> imageForCurrentFrame() override; | 28 sk_sp<SkImage> imageForCurrentFrame() override; |
28 | 29 |
29 bool originClean() const { return m_isOriginClean; } | 30 bool originClean() const { return m_isOriginClean; } |
30 void setOriginClean(bool flag) { m_isOriginClean = flag; } | 31 void setOriginClean(bool flag) { m_isOriginClean = flag; } |
31 bool isPremultiplied() const { return m_isPremultiplied; } | 32 bool isPremultiplied() const { return m_isPremultiplied; } |
32 void setPremultiplied(bool flag) { m_isPremultiplied = flag; } | 33 void setPremultiplied(bool flag) { m_isPremultiplied = flag; } |
33 bool isTextureBacked() override; | 34 bool isTextureBacked() override; |
34 virtual void copyToTexture(WebGraphicsContext3DProvider*, GLuint, GLenum, GL
enum, bool) { NOTREACHED(); } | 35 virtual void copyToTexture(WebGraphicsContext3DProvider*, GLuint, GLenum, GL
enum, bool) { NOTREACHED(); } |
35 virtual bool hasMailbox() { return false; } | 36 virtual bool hasMailbox() { return false; } |
36 | 37 |
37 protected: | 38 protected: |
38 StaticBitmapImage(PassRefPtr<SkImage>); | 39 StaticBitmapImage(sk_sp<SkImage>); |
39 StaticBitmapImage() { } // empty constructor for derived class. | 40 StaticBitmapImage() { } // empty constructor for derived class. |
40 RefPtr<SkImage> m_image; | 41 sk_sp<SkImage> m_image; |
41 | 42 |
42 private: | 43 private: |
43 bool m_isOriginClean = true; | 44 bool m_isOriginClean = true; |
44 // The premultiply info is stored here because the SkImage API | 45 // The premultiply info is stored here because the SkImage API |
45 // doesn't expose this info. | 46 // doesn't expose this info. |
46 bool m_isPremultiplied = true; | 47 bool m_isPremultiplied = true; |
47 }; | 48 }; |
48 | 49 |
49 } // namespace blink | 50 } // namespace blink |
50 | 51 |
51 #endif | 52 #endif |
OLD | NEW |