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

Side by Side Diff: src/gpu/effects/GrEllipseEdgeEffect.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/effects/GrEdgeEffect.cpp ('k') | src/gpu/effects/GrEllipseEdgeEffect.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 GrEllipseEdgeEffect_DEFINED
9 #define GrEllipseEdgeEffect_DEFINED
10
11 #include "GrEffect.h"
12
13 class GrGLEllipseEdgeEffect;
14
15 /**
16 * The output of this effect is a modulation of the input color and coverage for an axis-aligned
17 * ellipse, specified as center_x, center_y, x_radius, x_radius/y_radius in wind ow space (y-down).
18 */
19
20 class GrEllipseEdgeEffect : public GrEffect {
21 public:
22 static GrEffectRef* Create(bool stroke) {
23 // we go through this so we only have one copy of each effect (stroked/f illed)
24 static SkAutoTUnref<GrEffectRef> gEllipseStrokeEdgeEffectRef(
25 CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrEllipseEdge Effect, (true)))));
26 static SkAutoTUnref<GrEffectRef> gEllipseFillEdgeEffectRef(
27 CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrEllipseEdge Effect, (false)))));
28
29 if (stroke) {
30 gEllipseStrokeEdgeEffectRef.get()->ref();
31 return gEllipseStrokeEdgeEffectRef;
32 } else {
33 gEllipseFillEdgeEffectRef.get()->ref();
34 return gEllipseFillEdgeEffectRef;
35 }
36 }
37
38 virtual ~GrEllipseEdgeEffect() {}
39
40 static const char* Name() { return "EllipseEdge"; }
41
42 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
43
44 typedef GrGLEllipseEdgeEffect GLEffect;
45
46 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
47
48 inline bool isStroked() const { return fStroke; }
49
50 private:
51 GrEllipseEdgeEffect(bool stroke);
52
53 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE {
54 const GrEllipseEdgeEffect& eee = CastEffect<GrEllipseEdgeEffect>(other);
55 return eee.fStroke == fStroke;
56 }
57
58 bool fStroke;
59
60 GR_DECLARE_EFFECT_TEST;
61
62 typedef GrEffect INHERITED;
63 };
64
65 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrEdgeEffect.cpp ('k') | src/gpu/effects/GrEllipseEdgeEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698