Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Unified Diff: src/effects/gradients/SkTwoPointConicalGradient.h

Issue 207683004: Extract most of the mutable state of SkShader into a separate Context object. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/gradients/SkSweepGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « src/effects/gradients/SkSweepGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698