Chromium Code Reviews| Index: src/core/SkCoreBlitters.h |
| diff --git a/src/core/SkCoreBlitters.h b/src/core/SkCoreBlitters.h |
| index 285184050ba88737b3b94391812a5af246e5da31..f27e3842f6ed77af742bf54c3f7ff0a79bd80e83 100644 |
| --- a/src/core/SkCoreBlitters.h |
| +++ b/src/core/SkCoreBlitters.h |
| @@ -27,12 +27,29 @@ private: |
| class SkShaderBlitter : public SkRasterBlitter { |
| public: |
| - SkShaderBlitter(const SkBitmap& device, const SkPaint& paint); |
| + // TODO(dominikg): Should this class have its own SkSmallAllocator for storing the |
| + // shader context? Would avoid weird ownership issues (see below). |
| + /** |
| + * The storage for shaderContext is owned by the caller, but the object itself is not. |
| + * The blitter only ensures that the storage always holds a live object. |
| + */ |
| + SkShaderBlitter(const SkBitmap& device, const SkPaint& paint, |
| + SkShader::Context* shaderContext); |
| virtual ~SkShaderBlitter(); |
| + /** |
| + * Create a new shader context and uses it instead of the old one if successful. |
| + * Will create the context at the same location as the old one (this is safe |
| + * because the shader itself is unchanged). |
| + */ |
| + virtual bool resetShaderContext(const SkBitmap& device, const SkPaint& paint, |
| + const SkMatrix& matrix) SK_OVERRIDE; |
| + |
| protected: |
| - uint32_t fShaderFlags; |
| - SkShader* fShader; |
| + uint32_t fShaderFlags; |
| + const SkShader* fShader; |
| + SkShader::Context* fShaderContext; |
| + bool fShaderContextIsValid; |
|
scroggo
2014/03/24 21:24:46
Why is this needed (it appears that it is never us
Dominik Grewe
2014/03/26 17:22:22
You're right. Thanks for spotting. It was used in
|
| private: |
| // illegal |
| @@ -75,7 +92,8 @@ private: |
| class SkA8_Shader_Blitter : public SkShaderBlitter { |
| public: |
| - SkA8_Shader_Blitter(const SkBitmap& device, const SkPaint& paint); |
| + SkA8_Shader_Blitter(const SkBitmap& device, const SkPaint& paint, |
| + SkShader::Context* shaderContext); |
| virtual ~SkA8_Shader_Blitter(); |
| virtual void blitH(int x, int y, int width); |
| virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]); |
| @@ -141,7 +159,8 @@ private: |
| class SkARGB32_Shader_Blitter : public SkShaderBlitter { |
| public: |
| - SkARGB32_Shader_Blitter(const SkBitmap& device, const SkPaint& paint); |
| + SkARGB32_Shader_Blitter(const SkBitmap& device, const SkPaint& paint, |
| + SkShader::Context* shaderContext); |
| virtual ~SkARGB32_Shader_Blitter(); |
| virtual void blitH(int x, int y, int width) SK_OVERRIDE; |
| virtual void blitV(int x, int y, int height, SkAlpha alpha) SK_OVERRIDE; |
| @@ -179,6 +198,7 @@ private: |
| */ |
| SkBlitter* SkBlitter_ChooseD565(const SkBitmap& device, const SkPaint& paint, |
| + SkShader::Context* shaderContext, |
| SkTBlitterAllocator* allocator); |
| #endif |