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