Index: include/core/SkComposeShader.h |
diff --git a/include/core/SkComposeShader.h b/include/core/SkComposeShader.h |
index 1fefd1369a1c3eec87146f43abeacd02b9aa0c54..438cd971b22a921c5bdb933f728826586299194c 100644 |
--- a/include/core/SkComposeShader.h |
+++ b/include/core/SkComposeShader.h |
@@ -20,7 +20,7 @@ class SkXfermode; |
This subclass of shader returns the coposition of two other shaders, combined by |
a xfermode. |
*/ |
-class SK_API SkComposeShader : public SkShader { |
+class SK_API SkComposeShader : public SkShaderGenerator { |
public: |
/** Create a new compose shader, given shaders A, B, and a combining xfermode mode. |
When the xfermode is called, it will be given the result from shader A as its |
@@ -31,13 +31,31 @@ public: |
@param mode The xfermode that combines the colors from the two shaders. If mode |
is null, then SRC_OVER is assumed. |
*/ |
- SkComposeShader(SkShader* sA, SkShader* sB, SkXfermode* mode = NULL); |
+ SkComposeShader(SkShaderGenerator* sA, SkShaderGenerator* sB, SkXfermode* mode = NULL); |
virtual ~SkComposeShader(); |
- virtual bool setContext(const SkBitmap&, const SkPaint&, |
- const SkMatrix&) SK_OVERRIDE; |
- virtual void endContext() SK_OVERRIDE; |
- virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; |
+ virtual size_t shaderImplSize() const SK_OVERRIDE; |
+ |
+ virtual bool validContext(const SkBitmap&, const SkPaint&, |
+ const SkMatrix&) SK_OVERRIDE; |
+ |
+ virtual ShaderImpl* createShaderImpl(const SkBitmap&, const SkPaint&, |
+ const SkMatrix&, void*) const SK_OVERRIDE; |
+ |
+ class ComposeImpl : public ShaderImpl { |
+ public: |
+ // Takes ownership of implA and implB, and calls their destructors. |
+ ComposeImpl(const SkComposeShader&, const SkBitmap&, const SkPaint&, |
+ const SkMatrix&, ShaderImpl* implA, ShaderImpl* implB); |
+ |
+ ~ComposeImpl(); |
+ |
+ virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; |
+ private: |
+ ShaderImpl* fShaderImplA; |
+ ShaderImpl* fShaderImplB; |
+ }; |
+ |
SK_DEVELOPER_TO_STRING() |
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) |
@@ -48,11 +66,13 @@ protected: |
private: |
- SkShader* fShaderA; |
- SkShader* fShaderB; |
+ SkShaderGenerator* fShaderA; |
+ SkShaderGenerator* fShaderB; |
SkXfermode* fMode; |
- typedef SkShader INHERITED; |
+ friend class ComposeImpl; |
+ |
+ typedef SkShaderGenerator INHERITED; |
}; |
#endif |