Chromium Code Reviews| 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 "public/platform/WebExternalTextureMailbox.h" | 9 #include "public/platform/WebExternalTextureMailbox.h" |
| 10 #include "third_party/khronos/GLES2/gl2.h" | |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 class PLATFORM_EXPORT StaticBitmapImage final : public Image { | 14 class PLATFORM_EXPORT StaticBitmapImage final : public Image { |
| 14 public: | 15 public: |
| 15 ~StaticBitmapImage() override; | 16 ~StaticBitmapImage() override; |
| 16 | 17 |
| 17 bool currentFrameIsComplete() override { return true; } | 18 bool currentFrameIsComplete() override { return true; } |
| 18 | 19 |
| 19 static PassRefPtr<StaticBitmapImage> create(PassRefPtr<SkImage>); | 20 static PassRefPtr<StaticBitmapImage> create(PassRefPtr<SkImage>); |
| 20 static PassRefPtr<StaticBitmapImage> create(WebExternalTextureMailbox&); | 21 static PassRefPtr<StaticBitmapImage> create(WebExternalTextureMailbox&); |
| 21 virtual void destroyDecodedData() { } | 22 virtual void destroyDecodedData() { } |
| 22 virtual bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata); | 23 virtual bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata); |
| 23 virtual IntSize size() const; | 24 virtual IntSize size() const; |
| 24 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; | 25 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; |
| 25 | 26 |
| 26 PassRefPtr<SkImage> imageForCurrentFrame() override; | 27 PassRefPtr<SkImage> imageForCurrentFrame(WebGraphicsContext3DProvider* = nul lptr) override; |
| 27 | 28 |
| 28 bool originClean() const { return m_isOriginClean; } | 29 bool originClean() const { return m_isOriginClean; } |
| 29 void setOriginClean(bool flag) { m_isOriginClean = flag; } | 30 void setOriginClean(bool flag) { m_isOriginClean = flag; } |
| 30 bool isPremultiplied() const { return m_isPremultiplied; } | 31 bool isPremultiplied() const { return m_isPremultiplied; } |
| 31 void setPremultiplied(bool flag) { m_isPremultiplied = flag; } | 32 void setPremultiplied(bool flag) { m_isPremultiplied = flag; } |
| 33 void copyTexture(WebGraphicsContext3DProvider*, GLuint, GLenum, GLenum); | |
| 34 bool hasContext3DProvider() const { return !!m_provider; } | |
|
Justin Novosad
2016/06/07 15:11:07
!! is not necessary You should only use that when
xidachen
2016/06/07 17:49:54
I am not sure how windows bots will react to this,
| |
| 35 bool hasSkImage() const { return !!m_image; } | |
|
Justin Novosad
2016/06/07 15:11:07
same here
| |
| 36 | |
| 32 protected: | 37 protected: |
| 33 StaticBitmapImage(PassRefPtr<SkImage>); | 38 StaticBitmapImage(PassRefPtr<SkImage>); |
| 34 StaticBitmapImage(WebExternalTextureMailbox&); | 39 StaticBitmapImage(WebExternalTextureMailbox&); |
| 35 | 40 |
| 41 private: | |
| 42 void consumeTextureMailbox(WebGraphicsContext3DProvider*); | |
| 43 bool prepareMailboxForSkImage(WebGraphicsContext3DProvider*); | |
| 44 | |
| 36 RefPtr<SkImage> m_image; | 45 RefPtr<SkImage> m_image; |
| 37 WebExternalTextureMailbox m_mailbox; | 46 WebExternalTextureMailbox m_mailbox; |
| 47 OwnPtr<WebGraphicsContext3DProvider> m_provider; | |
| 48 // Cached textureId from CreateAndConsumeTextureCHROMIUM | |
| 49 GLuint m_textureId = 0; | |
| 38 bool m_isOriginClean = true; | 50 bool m_isOriginClean = true; |
| 39 // The premultiply info is stored here because the SkImage API | 51 // The premultiply info is stored here because the SkImage API |
| 40 // doesn't expose this info. | 52 // doesn't expose this info. |
| 41 bool m_isPremultiplied = true; | 53 bool m_isPremultiplied = true; |
| 42 }; | 54 }; |
| 43 | 55 |
| 44 } // namespace blink | 56 } // namespace blink |
| 45 | 57 |
| 46 #endif | 58 #endif |
| OLD | NEW |