Index: include/core/SkColorShader.h |
diff --git a/include/core/SkColorShader.h b/include/core/SkColorShader.h |
index 5b8a86dfc1b0b93dd2a2580c6b461fb779384869..a1d5b273218b1c712080529717acb041e73c6497 100644 |
--- a/include/core/SkColorShader.h |
+++ b/include/core/SkColorShader.h |
@@ -30,16 +30,33 @@ public: |
*/ |
SkColorShader(SkColor c); |
- virtual ~SkColorShader(); |
- |
- virtual uint32_t getFlags() SK_OVERRIDE; |
- virtual uint8_t getSpan16Alpha() const SK_OVERRIDE; |
virtual bool isOpaque() const SK_OVERRIDE; |
- virtual bool setContext(const SkBitmap& device, const SkPaint& paint, |
- const SkMatrix& matrix) SK_OVERRIDE; |
- virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRIDE; |
- virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; |
- virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE; |
+ |
+ virtual size_t shaderImplSize() const OVERRIDE { |
+ return sizeof(CSImpl); |
+ } |
+ |
+ virtual ShaderImpl* createShaderImpl(const SkBitmap& device, |
+ const SkPaint& paint, |
+ const SkMatrix& matrix, |
+ void* storage) const SK_OVERRIDE; |
+ |
+ class CSImpl : public SkShaderGenerator::ShaderImpl { |
+ public: |
+ CSImpl(const SkShaderGenerator& shader, const SkBitmap& device, |
+ const SkPaint& paint, const SkMatrix& matrix); |
+ |
+ virtual uint32_t getFlags() SK_OVERRIDE; |
+ virtual uint8_t getSpan16Alpha() const SK_OVERRIDE; |
+ virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRIDE; |
+ virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE; |
+ virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE; |
+ |
+ private: |
+ SkPMColor fPMColor; |
+ uint32_t fFlags; |
+ uint16_t fColor16; |
+ }; |
// we return false for this, use asAGradient |
virtual BitmapType asABitmap(SkBitmap* outTexture, |
@@ -49,21 +66,20 @@ public: |
virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; |
SK_DEVELOPER_TO_STRING() |
- SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader) |
+ |
+ virtual Factory getFactory() const SK_OVERRIDE { return CreateProc; } |
+ static SkFlattenable* CreateProc(SkReadBuffer& buffer); |
protected: |
- SkColorShader(SkReadBuffer&); |
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
private: |
+ const SkColor fColor; // ignored if fInheritColor is true |
+ const SkBool8 fInheritColor; |
- SkColor fColor; // ignored if fInheritColor is true |
- SkPMColor fPMColor; // cached after setContext() |
- uint32_t fFlags; // cached after setContext() |
- uint16_t fColor16; // cached after setContext() |
- SkBool8 fInheritColor; |
+ friend class CSImpl; |
- typedef SkShader INHERITED; |
+ typedef SkShaderGenerator INHERITED; |
}; |
#endif |