Chromium Code Reviews| Index: include/core/SkComposeShader.h |
| diff --git a/include/core/SkComposeShader.h b/include/core/SkComposeShader.h |
| index e29578cabc866987aaa1635bb0fbc03c11675bbf..1966db7f038b862d902a09ae17f28b5a43e4f8c5 100644 |
| --- a/include/core/SkComposeShader.h |
| +++ b/include/core/SkComposeShader.h |
| @@ -34,10 +34,36 @@ public: |
| SkComposeShader(SkShader* sA, SkShader* 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 bool validContext(const SkBitmap&, const SkPaint&, |
| + const SkMatrix&, SkMatrix* totalInverse = NULL) const SK_OVERRIDE; |
| + virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, |
| + const SkMatrix&, void*) const SK_OVERRIDE; |
| + virtual size_t contextSize() const SK_OVERRIDE; |
| + |
| + class ComposeShaderContext : public SkShader::Context { |
| + public: |
| + // Takes ownership of contextA and contextB, and calls their destructors. |
|
scroggo
2014/04/03 15:35:54
nit: As with the bitmap proc shader/state, I think
Dominik Grewe
2014/04/04 10:59:41
Comment updated.
|
| + ComposeShaderContext(const SkComposeShader&, const SkBitmap&, |
| + const SkPaint&, const SkMatrix&, |
| + SkShader::Context* contextA, SkShader::Context* contextB); |
| + |
| + SkShader::Context* getShaderContextA() const { return fShaderContextA; } |
| + SkShader::Context* getShaderContextB() const { return fShaderContextB; } |
| + |
| + virtual ~ComposeShaderContext(); |
| + |
| + virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE; |
| + private: |
| + SkShader::Context* fShaderContextA; |
| + SkShader::Context* fShaderContextB; |
| + |
| + typedef SkShader::Context INHERITED; |
| + }; |
| + |
| +#if SK_DEBUG |
| + SkShader* getShaderA() { return fShaderA; } |
| + SkShader* getShaderB() { return fShaderB; } |
| +#endif |
| SK_TO_STRING_OVERRIDE() |
| SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader) |
| @@ -52,6 +78,8 @@ private: |
| SkShader* fShaderB; |
| SkXfermode* fMode; |
| + friend class ComposeImpl; |
| + |
| typedef SkShader INHERITED; |
| }; |