Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "skia/ext/cdl_common.h"
11 #include "third_party/khronos/GLES2/gl2.h" 12 #include "third_party/khronos/GLES2/gl2.h"
12 #include "third_party/skia/include/core/SkRefCnt.h" 13 #include "third_party/skia/include/core/SkRefCnt.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class WebGraphicsContext3DProvider; 17 class WebGraphicsContext3DProvider;
17 18
18 class PLATFORM_EXPORT StaticBitmapImage : public Image { 19 class PLATFORM_EXPORT StaticBitmapImage : public Image {
19 public: 20 public:
20 static PassRefPtr<StaticBitmapImage> create(sk_sp<SkImage>); 21 static PassRefPtr<StaticBitmapImage> create(sk_sp<SkImage>);
21 22
22 // Methods overrided by all sub-classes 23 // Methods overrided by all sub-classes
23 virtual ~StaticBitmapImage() {} 24 virtual ~StaticBitmapImage() {}
24 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) = 0; 25 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) = 0;
25 sk_sp<SkImage> imageForCurrentFrame() = 0; 26 sk_sp<SkImage> imageForCurrentFrame() = 0;
26 bool isTextureBacked() = 0; 27 bool isTextureBacked() = 0;
27 void draw(SkCanvas*, 28 void draw(CdlCanvas*,
28 const SkPaint&, 29 const CdlPaint&,
29 const FloatRect& dstRect, 30 const FloatRect& dstRect,
30 const FloatRect& srcRect, 31 const FloatRect& srcRect,
31 RespectImageOrientationEnum, 32 RespectImageOrientationEnum,
32 ImageClampingMode) = 0; 33 ImageClampingMode) = 0;
33 34
34 // Methods have common implementation for all sub-classes 35 // Methods have common implementation for all sub-classes
35 bool currentFrameIsComplete() override { return true; } 36 bool currentFrameIsComplete() override { return true; }
36 void destroyDecodedData() {} 37 void destroyDecodedData() {}
37 38
38 // Methods that have a default implementation, and overrided by only one 39 // Methods that have a default implementation, and overrided by only one
(...skipping 20 matching lines...) Expand all
59 virtual void updateSyncToken(gpu::SyncToken) { NOTREACHED(); } 60 virtual void updateSyncToken(gpu::SyncToken) { NOTREACHED(); }
60 61
61 // Methods have exactly the same implementation for all sub-classes 62 // Methods have exactly the same implementation for all sub-classes
62 bool originClean() const { return m_isOriginClean; } 63 bool originClean() const { return m_isOriginClean; }
63 void setOriginClean(bool flag) { m_isOriginClean = flag; } 64 void setOriginClean(bool flag) { m_isOriginClean = flag; }
64 bool isPremultiplied() const { return m_isPremultiplied; } 65 bool isPremultiplied() const { return m_isPremultiplied; }
65 void setPremultiplied(bool flag) { m_isPremultiplied = flag; } 66 void setPremultiplied(bool flag) { m_isPremultiplied = flag; }
66 67
67 protected: 68 protected:
68 // Helper for sub-classes 69 // Helper for sub-classes
69 void drawHelper(SkCanvas*, 70 void drawHelper(CdlCanvas*,
70 const SkPaint&, 71 const CdlPaint&,
71 const FloatRect&, 72 const FloatRect&,
72 const FloatRect&, 73 const FloatRect&,
73 ImageClampingMode, 74 ImageClampingMode,
74 sk_sp<SkImage>); 75 sk_sp<SkImage>);
75 76
76 // These two properties are here because the SkImage API doesn't expose the 77 // These two properties are here because the SkImage API doesn't expose the
77 // info. They applied to both UnacceleratedStaticBitmapImage and 78 // info. They applied to both UnacceleratedStaticBitmapImage and
78 // AcceleratedStaticBitmapImage. To change these two properties, the call 79 // AcceleratedStaticBitmapImage. To change these two properties, the call
79 // site would have to call the API setOriginClean() and setPremultiplied(). 80 // site would have to call the API setOriginClean() and setPremultiplied().
80 bool m_isOriginClean = true; 81 bool m_isOriginClean = true;
81 bool m_isPremultiplied = true; 82 bool m_isPremultiplied = true;
82 }; 83 };
83 84
84 } // namespace blink 85 } // namespace blink
85 86
86 #endif 87 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698