Chromium Code Reviews| Index: src/effects/gradients/SkTwoPointConicalGradient.h |
| diff --git a/src/effects/gradients/SkTwoPointConicalGradient.h b/src/effects/gradients/SkTwoPointConicalGradient.h |
| index 20a3da8b2e82a5c6fae7ba3ff958d196a58d6060..b30ee70595e496ef32fc09a5f7e3493e60bafff1 100644 |
| --- a/src/effects/gradients/SkTwoPointConicalGradient.h |
| +++ b/src/effects/gradients/SkTwoPointConicalGradient.h |
| @@ -11,6 +11,8 @@ |
| #include "SkGradientShaderPriv.h" |
| +// TODO(dominikg): Worth making it truly immutable (i.e. set values in constructor)? |
| +// Should only be initialized once via init(). Immutable afterwards. |
| struct TwoPtRadial { |
| enum { |
| kDontDrawT = 0x80000000 |
| @@ -27,16 +29,20 @@ struct TwoPtRadial { |
| void init(const SkPoint& center0, SkScalar rad0, |
| const SkPoint& center1, SkScalar rad1); |
| - // used by setup and nextT |
| + static bool DontDrawT(SkFixed t) { |
| + return kDontDrawT == (uint32_t)t; |
| + } |
| +}; |
| + |
| +// Mutable part of TwoPtRadial. |
|
scroggo
2014/04/02 20:16:53
I find this comment confusing, since it's no longe
Dominik Grewe
2014/04/03 12:12:59
Removed.
|
| +struct TwoPtRadialContext { |
|
scroggo
2014/04/02 20:16:53
This should probably be moved to the cpp file.
Dominik Grewe
2014/04/03 12:12:59
Done.
|
| float fRelX, fRelY, fIncX, fIncY; |
| float fB, fDB; |
|
scroggo
2014/04/02 20:16:53
It appears that fIncX, fIncY, and fDB could be con
Dominik Grewe
2014/04/03 12:12:59
Done.
|
| + const TwoPtRadial& fRec; |
|
scroggo
2014/04/02 20:16:53
nit: the variable names should be aligned.
Dominik Grewe
2014/04/03 12:12:59
Done.
|
| - void setup(SkScalar fx, SkScalar fy, SkScalar dfx, SkScalar dfy); |
| + TwoPtRadialContext(const TwoPtRadial& rec, SkScalar fx, SkScalar fy, |
| + SkScalar dfx, SkScalar dfy); |
| SkFixed nextT(); |
| - |
| - static bool DontDrawT(SkFixed t) { |
| - return kDontDrawT == (uint32_t)t; |
| - } |
| }; |
| @@ -49,11 +55,23 @@ public: |
| const SkPoint& end, SkScalar endRadius, |
| const Descriptor&); |
| - virtual void shadeSpan(int x, int y, SkPMColor* dstCParam, |
| - int count) SK_OVERRIDE; |
| - virtual bool setContext(const SkBitmap& device, |
| - const SkPaint& paint, |
| - const SkMatrix& matrix) SK_OVERRIDE; |
| + |
| + virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, const SkMatrix&, |
| + void* storage) const SK_OVERRIDE; |
| + virtual size_t contextSize() const SK_OVERRIDE; |
| + |
| + class TwoPointConicalGradientContext : public SkGradientShaderBase::GradientShaderBaseContext { |
| + public: |
| + TwoPointConicalGradientContext(const SkTwoPointConicalGradient& shader, |
| + const SkBitmap& device, |
| + const SkPaint& paint, |
| + const SkMatrix& matrix); |
| + ~TwoPointConicalGradientContext() {} |
| + |
| + virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; |
| + |
| + typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; |
| + }; |
| virtual BitmapType asABitmap(SkBitmap* bitmap, |
| SkMatrix* matrix, |