| 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 const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { | 47 virtual const void* onPeekPixels(SkImageInfo*, size_t* /*rowBytes*/) const { |
| 48 return nullptr; | 48 return nullptr; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Default impl calls onDraw | 51 // Default impl calls onDraw |
| 52 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, | 52 virtual bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_
t dstRowBytes, |
| 53 int srcX, int srcY) const; | 53 int srcX, int srcY) const; |
| 54 | 54 |
| 55 virtual void onPreroll(GrContext*) const {} | 55 virtual void onPreroll(GrContext*) const {} |
| 56 | 56 |
| 57 virtual GrTexture* getTexture() const { return nullptr; } | 57 virtual GrTexture* peekTexture() const { return nullptr; } |
| 58 | 58 |
| 59 // return a read-only copy of the pixels. We promise to not modify them, | 59 // return a read-only copy of the pixels. We promise to not modify them, |
| 60 // but only inspect them (or encode them). | 60 // but only inspect them (or encode them). |
| 61 virtual bool getROPixels(SkBitmap*) const { return false; } | 61 virtual bool getROPixels(SkBitmap*) const { return false; } |
| 62 | 62 |
| 63 virtual SkShader* onNewShader(SkShader::TileMode, | 63 virtual SkShader* onNewShader(SkShader::TileMode, |
| 64 SkShader::TileMode, | 64 SkShader::TileMode, |
| 65 const SkMatrix* localMatrix) const { return nu
llptr; } | 65 const SkMatrix* localMatrix) const { return nu
llptr; } |
| 66 | 66 |
| 67 // newWidth > 0, newHeight > 0, subset either nullptr or a proper subset of
this bounds | 67 // newWidth > 0, newHeight > 0, subset either nullptr or a proper subset of
this bounds |
| 68 virtual SkImage* onNewImage(int newWidth, int newHeight, const SkIRect* subs
et, | 68 virtual SkImage* onNewImage(int newWidth, int newHeight, const SkIRect* subs
et, |
| 69 SkFilterQuality) const; | 69 SkFilterQuality) const; |
| 70 virtual SkData* onRefEncoded() const { return nullptr; } | 70 virtual SkData* onRefEncoded() const { return nullptr; } |
| 71 | 71 |
| 72 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; | 72 virtual bool onAsLegacyBitmap(SkBitmap*, LegacyBitmapMode) const; |
| 73 | 73 |
| 74 virtual bool onIsLazyGenerated() const { return false; } | 74 virtual bool onIsLazyGenerated() const { return false; } |
| 75 | 75 |
| 76 // Caller must call unref when they are done. |
| 77 virtual GrTexture* asTextureRef(GrContext*, SkImageUsageType) const { return
nullptr; } |
| 78 |
| 76 private: | 79 private: |
| 77 const SkSurfaceProps fProps; | 80 const SkSurfaceProps fProps; |
| 78 | 81 |
| 79 typedef SkImage INHERITED; | 82 typedef SkImage INHERITED; |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 static inline SkImage_Base* as_IB(SkImage* image) { | 85 static inline SkImage_Base* as_IB(SkImage* image) { |
| 83 return static_cast<SkImage_Base*>(image); | 86 return static_cast<SkImage_Base*>(image); |
| 84 } | 87 } |
| 85 | 88 |
| 86 static inline const SkImage_Base* as_IB(const SkImage* image) { | 89 static inline const SkImage_Base* as_IB(const SkImage* image) { |
| 87 return static_cast<const SkImage_Base*>(image); | 90 return static_cast<const SkImage_Base*>(image); |
| 88 } | 91 } |
| 89 | 92 |
| 90 #endif | 93 #endif |
| OLD | NEW |