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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 virtual SkSurface* onNewSurface(const SkImageInfo& info) const { | 45 virtual SkSurface* onNewSurface(const SkImageInfo& info) const { |
46 return SkSurface::NewRaster(info); | 46 return SkSurface::NewRaster(info); |
47 } | 47 } |
48 | 48 |
49 // Caller must call unref when they are done. | 49 // Caller must call unref when they are done. |
50 virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const =
0; | 50 virtual GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const =
0; |
51 | 51 |
52 virtual SkImage* onNewSubset(const SkIRect&) const = 0; | 52 virtual SkImage* onNewSubset(const SkIRect&) const = 0; |
53 | 53 |
54 virtual SkData* onRefEncoded() const { return nullptr; } | 54 // If a ctx is specified, then only gpu-specific formats are requested. |
| 55 virtual SkData* onRefEncoded(GrContext*) const { return nullptr; } |
55 | 56 |
56 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; | 57 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; |
57 | 58 |
58 virtual bool onIsLazyGenerated() const { return false; } | 59 virtual bool onIsLazyGenerated() const { return false; } |
59 | 60 |
60 // Return a bitmap suitable for passing to image-filters | 61 // Return a bitmap suitable for passing to image-filters |
61 // For now, that means wrapping textures into SkGrPixelRefs... | 62 // For now, that means wrapping textures into SkGrPixelRefs... |
62 virtual bool asBitmapForImageFilters(SkBitmap* bitmap) const { | 63 virtual bool asBitmapForImageFilters(SkBitmap* bitmap) const { |
63 return this->getROPixels(bitmap, kAllow_CachingHint); | 64 return this->getROPixels(bitmap, kAllow_CachingHint); |
64 } | 65 } |
(...skipping 13 matching lines...) Expand all Loading... |
78 | 79 |
79 static inline SkImage_Base* as_IB(SkImage* image) { | 80 static inline SkImage_Base* as_IB(SkImage* image) { |
80 return static_cast<SkImage_Base*>(image); | 81 return static_cast<SkImage_Base*>(image); |
81 } | 82 } |
82 | 83 |
83 static inline const SkImage_Base* as_IB(const SkImage* image) { | 84 static inline const SkImage_Base* as_IB(const SkImage* image) { |
84 return static_cast<const SkImage_Base*>(image); | 85 return static_cast<const SkImage_Base*>(image); |
85 } | 86 } |
86 | 87 |
87 #endif | 88 #endif |
OLD | NEW |