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 23 matching lines...) Expand all Loading... |
34 * | 34 * |
35 * Currently the edges are specified in device space. In the future we may p
refer to specify | 35 * Currently the edges are specified in device space. In the future we may p
refer to specify |
36 * them in src space. There are a number of ways this could be accomplished
but we'd probably | 36 * them in src space. There are a number of ways this could be accomplished
but we'd probably |
37 * have to modify the effect/shaderbuilder interface to make it possible (e.
g. give access | 37 * have to modify the effect/shaderbuilder interface to make it possible (e.
g. give access |
38 * to the view matrix or untransformed positions in the fragment shader). | 38 * to the view matrix or untransformed positions in the fragment shader). |
39 */ | 39 */ |
40 static GrEffectRef* Create(GrEffectEdgeType edgeType, int n, const SkScalar
edges[]) { | 40 static GrEffectRef* Create(GrEffectEdgeType edgeType, int n, const SkScalar
edges[]) { |
41 if (n <= 0 || n > kMaxEdges || kHairlineAA_GrEffectEdgeType == edgeType)
{ | 41 if (n <= 0 || n > kMaxEdges || kHairlineAA_GrEffectEdgeType == edgeType)
{ |
42 return NULL; | 42 return NULL; |
43 } | 43 } |
44 return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrConvexPolyEffect, | 44 return SkNEW_ARGS(GrConvexPolyEffect, (edgeType, n, edges)); |
45 (edgeType, n, edges)))
); | |
46 } | 45 } |
47 | 46 |
48 /** | 47 /** |
49 * Creates an effect that clips against the path. If the path is not a conve
x polygon, is | 48 * Creates an effect that clips against the path. If the path is not a conve
x polygon, is |
50 * inverse filled, or has too many edges, this will return NULL. If offset i
s non-NULL, then | 49 * inverse filled, or has too many edges, this will return NULL. If offset i
s non-NULL, then |
51 * the path is translated by the vector. | 50 * the path is translated by the vector. |
52 */ | 51 */ |
53 static GrEffectRef* Create(GrEffectEdgeType, const SkPath&, const SkVector*
offset = NULL); | 52 static GrEffectRef* Create(GrEffectEdgeType, const SkPath&, const SkVector*
offset = NULL); |
54 | 53 |
55 /** | 54 /** |
(...skipping 26 matching lines...) Expand all Loading... |
82 int fEdgeCount; | 81 int fEdgeCount; |
83 SkScalar fEdges[3 * kMaxEdges]; | 82 SkScalar fEdges[3 * kMaxEdges]; |
84 | 83 |
85 GR_DECLARE_EFFECT_TEST; | 84 GR_DECLARE_EFFECT_TEST; |
86 | 85 |
87 typedef GrEffect INHERITED; | 86 typedef GrEffect INHERITED; |
88 }; | 87 }; |
89 | 88 |
90 | 89 |
91 #endif | 90 #endif |
OLD | NEW |