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 28 matching lines...) Expand all Loading... |
39 // but only inspect them (or encode them). | 39 // but only inspect them (or encode them). |
40 virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const
= 0; | 40 virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const
= 0; |
41 | 41 |
42 virtual SkSurface* onNewSurface(const SkImageInfo& info) const { | 42 virtual SkSurface* onNewSurface(const SkImageInfo& info) const { |
43 return SkSurface::NewRaster(info); | 43 return SkSurface::NewRaster(info); |
44 } | 44 } |
45 | 45 |
46 // Caller must call unref when they are done. | 46 // Caller must call unref when they are done. |
47 virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const =
0; | 47 virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const =
0; |
48 | 48 |
49 virtual SkImage* onNewSubset(const SkIRect&) const = 0; | 49 virtual sk_sp<SkImage> onMakeSubset(const SkIRect&) const = 0; |
50 | 50 |
51 // If a ctx is specified, then only gpu-specific formats are requested. | 51 // If a ctx is specified, then only gpu-specific formats are requested. |
52 virtual SkData* onRefEncoded(GrContext*) const { return nullptr; } | 52 virtual SkData* onRefEncoded(GrContext*) const { return nullptr; } |
53 | 53 |
54 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; | 54 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; |
55 | 55 |
56 virtual bool onIsLazyGenerated() const { return false; } | 56 virtual bool onIsLazyGenerated() const { return false; } |
57 | 57 |
58 // Return a bitmap suitable for passing to image-filters | 58 // Return a bitmap suitable for passing to image-filters |
59 // For now, that means wrapping textures into SkGrPixelRefs... | 59 // For now, that means wrapping textures into SkGrPixelRefs... |
(...skipping 16 matching lines...) Expand all Loading... |
76 | 76 |
77 static inline SkImage_Base* as_IB(SkImage* image) { | 77 static inline SkImage_Base* as_IB(SkImage* image) { |
78 return static_cast<SkImage_Base*>(image); | 78 return static_cast<SkImage_Base*>(image); |
79 } | 79 } |
80 | 80 |
81 static inline const SkImage_Base* as_IB(const SkImage* image) { | 81 static inline const SkImage_Base* as_IB(const SkImage* image) { |
82 return static_cast<const SkImage_Base*>(image); | 82 return static_cast<const SkImage_Base*>(image); |
83 } | 83 } |
84 | 84 |
85 #endif | 85 #endif |
OLD | NEW |