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 |
11 #include "SkAtomics.h" | 11 #include "SkAtomics.h" |
12 #include "SkImage.h" | 12 #include "SkImage.h" |
13 #include "SkSurface.h" | 13 #include "SkSurface.h" |
14 | 14 |
15 #include <new> | 15 #include <new> |
16 | 16 |
17 class GrTextureParams; | 17 class GrTextureParams; |
| 18 class SkImageCacherator; |
18 | 19 |
19 enum { | 20 enum { |
20 kNeedNewImageUniqueID = 0 | 21 kNeedNewImageUniqueID = 0 |
21 }; | 22 }; |
22 | 23 |
23 class SkImage_Base : public SkImage { | 24 class SkImage_Base : public SkImage { |
24 public: | 25 public: |
25 SkImage_Base(int width, int height, uint32_t uniqueID); | 26 SkImage_Base(int width, int height, uint32_t uniqueID); |
26 virtual ~SkImage_Base(); | 27 virtual ~SkImage_Base(); |
27 | 28 |
28 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const {
return nullptr; } | 29 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const {
return nullptr; } |
29 | 30 |
30 // Default impl calls onDraw | 31 // Default impl calls onDraw |
31 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, | 32 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, |
32 int srcX, int srcY, CachingHint) const; | 33 int srcX, int srcY, CachingHint) const; |
33 | 34 |
34 virtual GrTexture* peekTexture() const { return nullptr; } | 35 virtual GrTexture* peekTexture() const { return nullptr; } |
| 36 virtual SkImageCacherator* peekCacherator() const { return nullptr; } |
35 | 37 |
36 // return a read-only copy of the pixels. We promise to not modify them, | 38 // return a read-only copy of the pixels. We promise to not modify them, |
37 // but only inspect them (or encode them). | 39 // but only inspect them (or encode them). |
38 virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const
= 0; | 40 virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const
= 0; |
39 | 41 |
40 virtual SkImage* onApplyFilter(SkImageFilter*, SkIPoint* offset, | 42 virtual SkImage* onApplyFilter(SkImageFilter*, SkIPoint* offset, |
41 bool forceResultToOriginalSize) const; | 43 bool forceResultToOriginalSize) const; |
42 | 44 |
43 virtual SkSurface* onNewSurface(const SkImageInfo& info) const { | 45 virtual SkSurface* onNewSurface(const SkImageInfo& info) const { |
44 return SkSurface::NewRaster(info); | 46 return SkSurface::NewRaster(info); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 78 |
77 static inline SkImage_Base* as_IB(SkImage* image) { | 79 static inline SkImage_Base* as_IB(SkImage* image) { |
78 return static_cast<SkImage_Base*>(image); | 80 return static_cast<SkImage_Base*>(image); |
79 } | 81 } |
80 | 82 |
81 static inline const SkImage_Base* as_IB(const SkImage* image) { | 83 static inline const SkImage_Base* as_IB(const SkImage* image) { |
82 return static_cast<const SkImage_Base*>(image); | 84 return static_cast<const SkImage_Base*>(image); |
83 } | 85 } |
84 | 86 |
85 #endif | 87 #endif |
OLD | NEW |