OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkImage_Base_DEFINED | 8 #ifndef SkImage_Base_DEFINED |
9 #define SkImage_Base_DEFINED | 9 #define SkImage_Base_DEFINED |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 SkImage_Base(int width, int height, uint32_t uniqueID); | 26 SkImage_Base(int width, int height, uint32_t uniqueID); |
27 virtual ~SkImage_Base(); | 27 virtual ~SkImage_Base(); |
28 | 28 |
29 // User: returns image info for this SkImage. | 29 // User: returns image info for this SkImage. |
30 // Implementors: if you can not return the value, return an invalid ImageInf
o with w=0 & h=0 | 30 // Implementors: if you can not return the value, return an invalid ImageInf
o with w=0 & h=0 |
31 // & unknown color space. | 31 // & unknown color space. |
32 virtual SkImageInfo onImageInfo() const = 0; | 32 virtual SkImageInfo onImageInfo() const = 0; |
33 | 33 |
34 virtual bool onPeekPixels(SkPixmap*) const { return false; } | 34 virtual bool onPeekPixels(SkPixmap*) const { return false; } |
35 | 35 |
| 36 virtual const SkBitmap* onPeekBitmap() const { return nullptr; } |
| 37 |
36 // Default impl calls onDraw | 38 // Default impl calls onDraw |
37 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, | 39 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, |
38 int srcX, int srcY, CachingHint) const; | 40 int srcX, int srcY, CachingHint) const; |
39 | 41 |
40 virtual GrTexture* peekTexture() const { return nullptr; } | 42 virtual GrTexture* peekTexture() const { return nullptr; } |
41 virtual SkImageCacherator* peekCacherator() const { return nullptr; } | 43 virtual SkImageCacherator* peekCacherator() const { return nullptr; } |
42 | 44 |
43 // return a read-only copy of the pixels. We promise to not modify them, | 45 // return a read-only copy of the pixels. We promise to not modify them, |
44 // but only inspect them (or encode them). | 46 // but only inspect them (or encode them). |
45 virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const
= 0; | 47 virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const
= 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 82 |
81 static inline SkImage_Base* as_IB(const sk_sp<SkImage>& image) { | 83 static inline SkImage_Base* as_IB(const sk_sp<SkImage>& image) { |
82 return static_cast<SkImage_Base*>(image.get()); | 84 return static_cast<SkImage_Base*>(image.get()); |
83 } | 85 } |
84 | 86 |
85 static inline const SkImage_Base* as_IB(const SkImage* image) { | 87 static inline const SkImage_Base* as_IB(const SkImage* image) { |
86 return static_cast<const SkImage_Base*>(image); | 88 return static_cast<const SkImage_Base*>(image); |
87 } | 89 } |
88 | 90 |
89 #endif | 91 #endif |
OLD | NEW |