Index: src/effects/gradients/SkTwoPointConicalGradient.h |
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.h b/src/effects/gradients/SkTwoPointConicalGradient.h |
index b2e258ee68b277bfce6e99ce1d4f179df0d9f2dc..80aa6fa6939ab3559cc9827df3fa5536718f7db0 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 |
@@ -29,13 +31,6 @@ struct TwoPtRadial { |
const SkPoint& center1, SkScalar rad1, |
bool flipped); |
- // used by setup and nextT |
- float fRelX, fRelY, fIncX, fIncY; |
- float fB, fDB; |
- |
- void setup(SkScalar fx, SkScalar fy, SkScalar dfx, SkScalar dfy); |
- SkFixed nextT(); |
- |
static bool DontDrawT(SkFixed t) { |
return kDontDrawT == (uint32_t)t; |
} |
@@ -51,11 +46,24 @@ public: |
const SkPoint& end, SkScalar endRadius, |
bool flippedGrad, 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; |
+ |
+ private: |
+ typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; |
+ }; |
virtual BitmapType asABitmap(SkBitmap* bitmap, |
SkMatrix* matrix, |