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

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

Issue 241283003: Revert of 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: 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 4c049172d3131fcce3303df03f0f96c9b4305f3b..041f8b8be44cd74e9c75c3da046e44a419689e7a 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.h
+++ b/src/effects/gradients/SkTwoPointConicalGradient.h
@@ -11,8 +11,6 @@
#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,6 +27,13 @@
void init(const SkPoint& center0, SkScalar rad0,
const SkPoint& center1, SkScalar rad1);
+ // 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;
}
@@ -44,24 +49,11 @@
const SkPoint& end, SkScalar endRadius,
const Descriptor&);
-
- 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 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 BitmapType asABitmap(SkBitmap* bitmap,
SkMatrix* matrix,
@@ -85,12 +77,11 @@
virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
private:
+ typedef SkGradientShaderBase INHERITED;
const SkPoint fCenter1;
const SkPoint fCenter2;
const SkScalar fRadius1;
const SkScalar fRadius2;
-
- typedef SkGradientShaderBase INHERITED;
};
#endif
« 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