| 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" | 8 #include "gpu/command_buffer/common/mailbox.h" | 
| 9 #include "gpu/command_buffer/common/sync_token.h" | 9 #include "gpu/command_buffer/common/sync_token.h" | 
| 10 #include "platform/graphics/Image.h" | 10 #include "platform/graphics/Image.h" | 
| 11 #include "third_party/khronos/GLES2/gl2.h" | 11 #include "third_party/khronos/GLES2/gl2.h" | 
| 12 #include "third_party/skia/include/core/SkRefCnt.h" | 12 #include "third_party/skia/include/core/SkRefCnt.h" | 
| 13 | 13 | 
| 14 namespace blink { | 14 namespace blink { | 
| 15 | 15 | 
| 16 class WebGraphicsContext3DProvider; | 16 class WebGraphicsContext3DProvider; | 
| 17 | 17 | 
| 18 class PLATFORM_EXPORT StaticBitmapImage : public Image { | 18 class PLATFORM_EXPORT StaticBitmapImage : public Image { | 
| 19  public: | 19  public: | 
| 20   static PassRefPtr<StaticBitmapImage> create(sk_sp<SkImage>); | 20   static PassRefPtr<StaticBitmapImage> create(sk_sp<SkImage>); | 
| 21 | 21 | 
| 22   // Methods overrided by all sub-classes | 22   // Methods overrided by all sub-classes | 
| 23   virtual ~StaticBitmapImage() {} | 23   virtual ~StaticBitmapImage() {} | 
| 24   bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) = 0; | 24   bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) = 0; | 
| 25   sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) = 0; | 25   sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) = 0; | 
| 26   void draw(SkCanvas*, | 26   void draw(PaintCanvas*, | 
| 27             const SkPaint&, | 27             const PaintFlags&, | 
| 28             const FloatRect& dstRect, | 28             const FloatRect& dstRect, | 
| 29             const FloatRect& srcRect, | 29             const FloatRect& srcRect, | 
| 30             RespectImageOrientationEnum, | 30             RespectImageOrientationEnum, | 
| 31             ImageClampingMode, | 31             ImageClampingMode, | 
| 32             const ColorBehavior&) = 0; | 32             const ColorBehavior&) = 0; | 
| 33 | 33 | 
| 34   // Methods have common implementation for all sub-classes | 34   // Methods have common implementation for all sub-classes | 
| 35   bool currentFrameIsComplete() override { return true; } | 35   bool currentFrameIsComplete() override { return true; } | 
| 36   void destroyDecodedData() {} | 36   void destroyDecodedData() {} | 
| 37 | 37 | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 61   virtual void updateSyncToken(gpu::SyncToken) { NOTREACHED(); } | 61   virtual void updateSyncToken(gpu::SyncToken) { NOTREACHED(); } | 
| 62 | 62 | 
| 63   // Methods have exactly the same implementation for all sub-classes | 63   // Methods have exactly the same implementation for all sub-classes | 
| 64   bool originClean() const { return m_isOriginClean; } | 64   bool originClean() const { return m_isOriginClean; } | 
| 65   void setOriginClean(bool flag) { m_isOriginClean = flag; } | 65   void setOriginClean(bool flag) { m_isOriginClean = flag; } | 
| 66   bool isPremultiplied() const { return m_isPremultiplied; } | 66   bool isPremultiplied() const { return m_isPremultiplied; } | 
| 67   void setPremultiplied(bool flag) { m_isPremultiplied = flag; } | 67   void setPremultiplied(bool flag) { m_isPremultiplied = flag; } | 
| 68 | 68 | 
| 69  protected: | 69  protected: | 
| 70   // Helper for sub-classes | 70   // Helper for sub-classes | 
| 71   void drawHelper(SkCanvas*, | 71   void drawHelper(PaintCanvas*, | 
| 72                   const SkPaint&, | 72                   const PaintFlags&, | 
| 73                   const FloatRect&, | 73                   const FloatRect&, | 
| 74                   const FloatRect&, | 74                   const FloatRect&, | 
| 75                   ImageClampingMode, | 75                   ImageClampingMode, | 
| 76                   sk_sp<SkImage>); | 76                   sk_sp<SkImage>); | 
| 77 | 77 | 
| 78   // These two properties are here because the SkImage API doesn't expose the | 78   // These two properties are here because the SkImage API doesn't expose the | 
| 79   // info. They applied to both UnacceleratedStaticBitmapImage and | 79   // info. They applied to both UnacceleratedStaticBitmapImage and | 
| 80   // AcceleratedStaticBitmapImage. To change these two properties, the call | 80   // AcceleratedStaticBitmapImage. To change these two properties, the call | 
| 81   // site would have to call the API setOriginClean() and setPremultiplied(). | 81   // site would have to call the API setOriginClean() and setPremultiplied(). | 
| 82   bool m_isOriginClean = true; | 82   bool m_isOriginClean = true; | 
| 83   bool m_isPremultiplied = true; | 83   bool m_isPremultiplied = true; | 
| 84 }; | 84 }; | 
| 85 | 85 | 
| 86 }  // namespace blink | 86 }  // namespace blink | 
| 87 | 87 | 
| 88 #endif | 88 #endif | 
| OLD | NEW | 
|---|