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

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

Issue 183833003: Make GrConvexPolyEffect support inverse fills and non-AA rects (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: update GM width 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/effects/GrConvexPolyEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrConvexPolyEffect_DEFINED 8 #ifndef GrConvexPolyEffect_DEFINED
9 #define GrConvexPolyEffect_DEFINED 9 #define GrConvexPolyEffect_DEFINED
10 10
11 #include "GrDrawTargetCaps.h" 11 #include "GrDrawTargetCaps.h"
12 #include "GrEffect.h" 12 #include "GrEffect.h"
13 13
14 class GrGLConvexPolyEffect; 14 class GrGLConvexPolyEffect;
15 class SkPath; 15 class SkPath;
16 16
17 /** 17 /**
18 * An effect that renders a convex polygon. It is intended to be used as a cover age effect. 18 * An effect that renders a convex polygon. It is intended to be used as a cover age effect.
19 * Bounding geometry is rendered and the effect computes coverage based on the f ragment's 19 * Bounding geometry is rendered and the effect computes coverage based on the f ragment's
20 * position relative to the polygon. 20 * position relative to the polygon.
21 */ 21 */
22 class GrConvexPolyEffect : public GrEffect { 22 class GrConvexPolyEffect : public GrEffect {
23 public: 23 public:
24 /** This could be expanded to include a AA hairline mode. If so, unify with GrBezierEffect's
25 enum. */
26 enum EdgeType { 24 enum EdgeType {
27 kFillNoAA_EdgeType, 25 kFillNoAA_EdgeType,
28 kFillAA_EdgeType, 26 kFillAA_EdgeType,
27 kInverseFillNoAA_EdgeType,
28 kInverseFillAA_EdgeType,
29 29
30 kLastEdgeType = kFillAA_EdgeType, 30 kLastEdgeType = kInverseFillAA_EdgeType,
31 }; 31 };
32 32
33 enum { 33 enum {
34 kEdgeTypeCnt = kLastEdgeType + 1, 34 kEdgeTypeCnt = kLastEdgeType + 1,
35 kMaxEdges = 8, 35 kMaxEdges = 8,
36 }; 36 };
37 37
38 /** 38 /**
39 * edges is a set of n edge equations where n is limited to kMaxEdges. It co ntains 3*n values. 39 * edges is a set of n edge equations where n is limited to kMaxEdges. It co ntains 3*n values.
40 * The edges should form a convex polygon. The positive half-plane is consid ered to be the 40 * The edges should form a convex polygon. The positive half-plane is consid ered to be the
(...skipping 16 matching lines...) Expand all
57 /** 57 /**
58 * Creates an effect that clips against the path. If the path is not a conve x polygon, is 58 * Creates an effect that clips against the path. If the path is not a conve x polygon, is
59 * inverse filled, or has too many edges, this will return NULL. If offset i s non-NULL, then 59 * inverse filled, or has too many edges, this will return NULL. If offset i s non-NULL, then
60 * the path is translated by the vector. 60 * the path is translated by the vector.
61 */ 61 */
62 static GrEffectRef* Create(EdgeType, const SkPath&, const SkVector* offset= NULL); 62 static GrEffectRef* Create(EdgeType, const SkPath&, const SkVector* offset= NULL);
63 63
64 /** 64 /**
65 * Creates an effect that fills inside the rect with AA edges.. 65 * Creates an effect that fills inside the rect with AA edges..
66 */ 66 */
67 static GrEffectRef* CreateForAAFillRect(const SkRect&); 67 static GrEffectRef* Create(EdgeType, const SkRect&);
68 68
69 virtual ~GrConvexPolyEffect(); 69 virtual ~GrConvexPolyEffect();
70 70
71 static const char* Name() { return "ConvexPoly"; } 71 static const char* Name() { return "ConvexPoly"; }
72 72
73 EdgeType getEdgeType() const { return fEdgeType; } 73 EdgeType getEdgeType() const { return fEdgeType; }
74 74
75 int getEdgeCount() const { return fEdgeCount; } 75 int getEdgeCount() const { return fEdgeCount; }
76 76
77 const SkScalar* getEdges() const { return fEdges; } 77 const SkScalar* getEdges() const { return fEdges; }
(...skipping 13 matching lines...) Expand all
91 int fEdgeCount; 91 int fEdgeCount;
92 SkScalar fEdges[3 * kMaxEdges]; 92 SkScalar fEdges[3 * kMaxEdges];
93 93
94 GR_DECLARE_EFFECT_TEST; 94 GR_DECLARE_EFFECT_TEST;
95 95
96 typedef GrEffect INHERITED; 96 typedef GrEffect INHERITED;
97 }; 97 };
98 98
99 99
100 #endif 100 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/effects/GrConvexPolyEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698