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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 virtual GrTexture* peekTexture() const { return nullptr; } | 47 virtual GrTexture* peekTexture() const { return nullptr; } |
48 #if SK_SUPPORT_GPU | 48 #if SK_SUPPORT_GPU |
49 virtual sk_sp<GrTexture> refPinnedTexture(uint32_t* uniqueID) const { return
nullptr; } | 49 virtual sk_sp<GrTexture> refPinnedTexture(uint32_t* uniqueID) const { return
nullptr; } |
50 #endif | 50 #endif |
51 virtual SkImageCacherator* peekCacherator() const { return nullptr; } | 51 virtual SkImageCacherator* peekCacherator() const { return nullptr; } |
52 | 52 |
53 // return a read-only copy of the pixels. We promise to not modify them, | 53 // return a read-only copy of the pixels. We promise to not modify them, |
54 // but only inspect them (or encode them). | 54 // but only inspect them (or encode them). |
55 virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const
= 0; | 55 virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const
= 0; |
56 | 56 |
57 virtual sk_sp<SkSurface> onNewSurface(const SkImageInfo& info) const { | |
58 return SkSurface::MakeRaster(info); | |
59 } | |
60 | |
61 // Caller must call unref when they are done. | 57 // Caller must call unref when they are done. |
62 virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&, | 58 virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&, |
63 SkSourceGammaTreatment) const = 0; | 59 SkSourceGammaTreatment) const = 0; |
64 | 60 |
65 virtual sk_sp<SkImage> onMakeSubset(const SkIRect&) const = 0; | 61 virtual sk_sp<SkImage> onMakeSubset(const SkIRect&) const = 0; |
66 | 62 |
67 // If a ctx is specified, then only gpu-specific formats are requested. | 63 // If a ctx is specified, then only gpu-specific formats are requested. |
68 virtual SkData* onRefEncoded(GrContext*) const { return nullptr; } | 64 virtual SkData* onRefEncoded(GrContext*) const { return nullptr; } |
69 | 65 |
70 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; | 66 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; |
(...skipping 22 matching lines...) Expand all Loading... |
93 | 89 |
94 static inline SkImage_Base* as_IB(const sk_sp<SkImage>& image) { | 90 static inline SkImage_Base* as_IB(const sk_sp<SkImage>& image) { |
95 return static_cast<SkImage_Base*>(image.get()); | 91 return static_cast<SkImage_Base*>(image.get()); |
96 } | 92 } |
97 | 93 |
98 static inline const SkImage_Base* as_IB(const SkImage* image) { | 94 static inline const SkImage_Base* as_IB(const SkImage* image) { |
99 return static_cast<const SkImage_Base*>(image); | 95 return static_cast<const SkImage_Base*>(image); |
100 } | 96 } |
101 | 97 |
102 #endif | 98 #endif |
OLD | NEW |