Index: src/core/SkPictureShader.h |
diff --git a/src/core/SkPictureShader.h b/src/core/SkPictureShader.h |
index ea74b56d73d857394f9c20b227d41368f1623fa0..d1be0591824e27e1f28962b665c7f33ba40995af 100644 |
--- a/src/core/SkPictureShader.h |
+++ b/src/core/SkPictureShader.h |
@@ -24,13 +24,33 @@ public: |
static SkPictureShader* Create(SkPicture*, TileMode, TileMode); |
virtual ~SkPictureShader(); |
- virtual bool setContext(const SkBitmap&, const SkPaint&, const SkMatrix&) SK_OVERRIDE; |
- virtual void endContext() SK_OVERRIDE; |
- virtual uint32_t getFlags() SK_OVERRIDE; |
+ virtual bool validContext(const SkBitmap&, const SkPaint&, |
+ const SkMatrix&, SkMatrix* totalInverse = NULL) const SK_OVERRIDE; |
+ virtual SkShader::Context* createContext(const SkBitmap& device, const SkPaint& paint, |
+ const SkMatrix& matrix, void* storage) const |
+ SK_OVERRIDE; |
+ virtual size_t contextSize() const SK_OVERRIDE; |
- virtual ShadeProc asAShadeProc(void** ctx) SK_OVERRIDE; |
- virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; |
- virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE; |
+ class PictureShaderContext : public SkShader::Context { |
+ public: |
+ PictureShaderContext(const SkPictureShader& shader, const SkBitmap& device, |
+ const SkPaint& paint, const SkMatrix& matrix, |
+ SkShader* bitmapShader); |
+ virtual ~PictureShaderContext(); |
+ |
+ virtual uint32_t getFlags() const SK_OVERRIDE; |
+ |
+ virtual ShadeProc asAShadeProc(void** ctx) SK_OVERRIDE; |
+ virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; |
+ virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE; |
+ |
+ private: |
+ SkAutoTUnref<SkShader> fBitmapShader; |
+ SkShader::Context* fBitmapShaderContext; |
+ void* fBitmapShaderContextStorage; |
+ |
+ typedef SkShader::Context INHERITED; |
+ }; |
SK_TO_STRING_OVERRIDE() |
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader) |
@@ -46,13 +66,18 @@ protected: |
private: |
SkPictureShader(SkPicture*, TileMode, TileMode); |
- bool buildBitmapShader(const SkMatrix&) const; |
+ SkShader* validInternal(const SkBitmap& device, const SkPaint& paint, |
+ const SkMatrix& matrix, SkMatrix* totalInverse) const; |
+ |
+ SkShader* refBitmapShader(const SkMatrix&) const; |
SkPicture* fPicture; |
TileMode fTmx, fTmy; |
- mutable SkAutoTUnref<SkShader> fCachedShader; |
+ mutable SkMutex fCachedBitmapShaderMutex; |
+ mutable SkAutoTUnref<SkShader> fCachedBitmapShader; |
mutable SkSize fCachedTileScale; |
+ mutable SkMatrix fCachedLocalMatrix; |
typedef SkShader INHERITED; |
}; |