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

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

Issue 222943002: Pull Gpu shader out of SkTwoPointConicalGradient into own file (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Gpu Support Check Created 6 years, 9 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
Index: src/effects/gradients/SkTwoPointConicalGradient_gpu.h
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.h b/src/effects/gradients/SkTwoPointConicalGradient_gpu.h
new file mode 100644
index 0000000000000000000000000000000000000000..2246f335a64c54a0d672b37cce6df3eea28015ab
--- /dev/null
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkTwoPointConicalGradient_gpu_DEFINED
+#define SkTwoPointconicalGradient_gpu_DEFINED
+
+#if SK_SUPPORT_GPU
+
+#include "SkGradientShaderPriv.h"
+
+class GrEffectRef;
+class SkTwoPointConicalGradient;
+class GrGL2PtConicalGradientEffect;
+
+class Gr2PtConicalGradientEffect : public GrGradientEffect {
+public:
+
+ static GrEffectRef* Create(GrContext* ctx,
+ const SkTwoPointConicalGradient& shader,
+ const SkMatrix& matrix,
+ SkShader::TileMode tm) {
+ AutoEffectUnref effect(SkNEW_ARGS(Gr2PtConicalGradientEffect, (ctx, shader, matrix, tm)));
+ return CreateEffectRef(effect);
+ }
+
+ virtual ~Gr2PtConicalGradientEffect() { }
+
+ static const char* Name() { return "Two-Point Conical Gradient"; }
+ virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+
+ // The radial gradient parameters can collapse to a linear (instead of quadratic) equation.
+ bool isDegenerate() const { return SkScalarAbs(fDiffRadius) == SkScalarAbs(fCenterX1); }
+ SkScalar center() const { return fCenterX1; }
+ SkScalar diffRadius() const { return fDiffRadius; }
+ SkScalar radius() const { return fRadius0; }
+
+ typedef GrGL2PtConicalGradientEffect GLEffect;
+
+private:
+ virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE {
+ const Gr2PtConicalGradientEffect& s = CastEffect<Gr2PtConicalGradientEffect>(sBase);
+ return (INHERITED::onIsEqual(sBase) &&
+ this->fCenterX1 == s.fCenterX1 &&
+ this->fRadius0 == s.fRadius0 &&
+ this->fDiffRadius == s.fDiffRadius);
+ }
+
+ Gr2PtConicalGradientEffect(GrContext* ctx,
+ const SkTwoPointConicalGradient& shader,
+ const SkMatrix& matrix,
+ SkShader::TileMode tm);
+
+ GR_DECLARE_EFFECT_TEST;
+
+ // @{
+ // Cache of values - these can change arbitrarily, EXCEPT
+ // we shouldn't change between degenerate and non-degenerate?!
+
+ GrCoordTransform fBTransform;
+ SkScalar fCenterX1;
+ SkScalar fRadius0;
+ SkScalar fDiffRadius;
+
+ // @}
+
+ typedef GrGradientEffect INHERITED;
+};
+#endif
+#endif
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698