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

Side by Side 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: Remove includes 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef Gr2PntConicalGradientEffect_DEFINED
9 #define Gr2PntConicalGradientEffect_DEFINED
10
11 #include "SkGradientShaderPriv.h"
12
13 class GrEffectRef;
14 class SkTwoPointConicalGradient;
15 class GrGL2PntConicalGradientEffect;
16
17 class Gr2PntConicalGradientEffect : public GrGradientEffect {
bsalomon 2014/04/02 21:12:04 How about 2Point or 2Pt? Just for consistency with
egdaniel 2014/04/03 14:36:56 done On 2014/04/02 21:12:04, bsalomon wrote:
18 public:
19
20 static GrEffectRef* Create(GrContext* ctx,
21 const SkTwoPointConicalGradient& shader,
22 const SkMatrix& matrix,
23 SkShader::TileMode tm) {
24 AutoEffectUnref effect(SkNEW_ARGS(Gr2PntConicalGradientEffect, (ctx, sha der, matrix, tm)));
25 return CreateEffectRef(effect);
26 }
27
28 virtual ~Gr2PntConicalGradientEffect() { }
29
30 static const char* Name() { return "Two-Point Conical Gradient"; }
31 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
32
33 // The radial gradient parameters can collapse to a linear (instead of quadr atic) equation.
34 bool isDegenerate() const { return SkScalarAbs(fDiffRadius) == SkScalarAbs(f CenterX1); }
35 SkScalar center() const { return fCenterX1; }
36 SkScalar diffRadius() const { return fDiffRadius; }
37 SkScalar radius() const { return fRadius0; }
38
39 typedef GrGL2PntConicalGradientEffect GLEffect;
40
41 private:
42 virtual bool onIsEqual(const GrEffect& sBase) const SK_OVERRIDE {
43 const Gr2PntConicalGradientEffect& s = CastEffect<Gr2PntConicalGradientE ffect>(sBase);
44 return (INHERITED::onIsEqual(sBase) &&
45 this->fCenterX1 == s.fCenterX1 &&
46 this->fRadius0 == s.fRadius0 &&
47 this->fDiffRadius == s.fDiffRadius);
48 }
49
50 Gr2PntConicalGradientEffect(GrContext* ctx,
51 const SkTwoPointConicalGradient& shader,
52 const SkMatrix& matrix,
53 SkShader::TileMode tm);
54
55 GR_DECLARE_EFFECT_TEST;
56
57 // @{
58 // Cache of values - these can change arbitrarily, EXCEPT
59 // we shouldn't change between degenerate and non-degenerate?!
60
61 GrCoordTransform fBTransform;
62 SkScalar fCenterX1;
63 SkScalar fRadius0;
64 SkScalar fDiffRadius;
65
66 // @}
67
68 typedef GrGradientEffect INHERITED;
69 };
70
71 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698