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

Side by Side Diff: src/gpu/effects/GrCircleEdgeEffect.h

Issue 13344002: Move edge GrEffects to locally defined classes (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: rebase to head revision Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/effects/GrCircleEdgeEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 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 GrCircleEdgeEffect_DEFINED
9 #define GrCircleEdgeEffect_DEFINED
10
11 #include "GrEffect.h"
12
13 class GrGLCircleEdgeEffect;
14
15 /**
16 * The output of this effect is a modulation of the input color and coverage for a circle,
17 * specified as center_x, center_y, x_radius, inner radius and outer radius in w indow space
18 * (y-down).
19 */
20
21 class GrCircleEdgeEffect : public GrEffect {
22 public:
23 static GrEffectRef* Create(bool stroke) {
24 // we go through this so we only have one copy of each effect (stroked/f illed)
25 static SkAutoTUnref<GrEffectRef> gCircleStrokeEdgeEffectRef(
26 CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrCircleEdgeE ffect, (true)))));
27 static SkAutoTUnref<GrEffectRef> gCircleFillEdgeEffectRef(
28 CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrCircleEdgeE ffect, (false)))));
29
30 if (stroke) {
31 gCircleStrokeEdgeEffectRef.get()->ref();
32 return gCircleStrokeEdgeEffectRef;
33 } else {
34 gCircleFillEdgeEffectRef.get()->ref();
35 return gCircleFillEdgeEffectRef;
36 }
37 }
38
39 virtual ~GrCircleEdgeEffect() {}
40
41 static const char* Name() { return "CircleEdge"; }
42
43 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
44
45 typedef GrGLCircleEdgeEffect GLEffect;
46
47 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
48
49 inline bool isStroked() const { return fStroke; }
50
51 private:
52 GrCircleEdgeEffect(bool stroke);
53
54 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
55 const GrCircleEdgeEffect& cee = CastEffect<GrCircleEdgeEffect>(other);
56 return cee.fStroke == fStroke;
57 }
58
59 bool fStroke;
60
61 GR_DECLARE_EFFECT_TEST;
62
63 typedef GrEffect INHERITED;
64 };
65
66 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/effects/GrCircleEdgeEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698