OLD | NEW |
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 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 static GrEffectRef* Create(EdgeType edgeType, int n, const SkScalar edges[])
{ | 50 static GrEffectRef* Create(EdgeType edgeType, int n, const SkScalar edges[])
{ |
51 if (n <= 0 || n > kMaxEdges) { | 51 if (n <= 0 || n > kMaxEdges) { |
52 return NULL; | 52 return NULL; |
53 } | 53 } |
54 return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrConvexPolyEffect, | 54 return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrConvexPolyEffect, |
55 (edgeType, n, edges)))
); | 55 (edgeType, n, edges)))
); |
56 } | 56 } |
57 | 57 |
58 /** | 58 /** |
59 * Creates an effect that clips against the path. If the path is not a conve
x polygon, is | 59 * Creates an effect that clips against the path. If the path is not a conve
x polygon, is |
60 * inverse filled, or has too many edges, this will return NULL. | 60 * inverse filled, or has too many edges, this will return NULL. If offset i
s non-NULL, then |
| 61 * the path is translated by the vector. |
61 */ | 62 */ |
62 static GrEffectRef* Create(EdgeType, const SkPath&); | 63 static GrEffectRef* Create(EdgeType, const SkPath&, const SkVector* offset=
NULL); |
63 | 64 |
64 virtual ~GrConvexPolyEffect(); | 65 virtual ~GrConvexPolyEffect(); |
65 | 66 |
66 static const char* Name() { return "ConvexPoly"; } | 67 static const char* Name() { return "ConvexPoly"; } |
67 | 68 |
68 EdgeType getEdgeType() const { return fEdgeType; } | 69 EdgeType getEdgeType() const { return fEdgeType; } |
69 | 70 |
70 int getEdgeCount() const { return fEdgeCount; } | 71 int getEdgeCount() const { return fEdgeCount; } |
71 | 72 |
72 const SkScalar* getEdges() const { return fEdges; } | 73 const SkScalar* getEdges() const { return fEdges; } |
(...skipping 13 matching lines...) Expand all Loading... |
86 int fEdgeCount; | 87 int fEdgeCount; |
87 SkScalar fEdges[3 * kMaxEdges]; | 88 SkScalar fEdges[3 * kMaxEdges]; |
88 | 89 |
89 GR_DECLARE_EFFECT_TEST; | 90 GR_DECLARE_EFFECT_TEST; |
90 | 91 |
91 typedef GrEffect INHERITED; | 92 typedef GrEffect INHERITED; |
92 }; | 93 }; |
93 | 94 |
94 | 95 |
95 #endif | 96 #endif |
OLD | NEW |