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 * 2d vector. | 34 * 2d vector. |
35 * | 35 * |
36 * Currently the edges are specified in device space. In the future we may p
refer to specify | 36 * Currently the edges are specified in device space. In the future we may p
refer to specify |
37 * them in src space. There are a number of ways this could be accomplished
but we'd probably | 37 * them in src space. There are a number of ways this could be accomplished
but we'd probably |
38 * have to modify the effect/shaderbuilder interface to make it possible (e.
g. give access | 38 * have to modify the effect/shaderbuilder interface to make it possible (e.
g. give access |
39 * to the view matrix or untransformed positions in the fragment shader). | 39 * to the view matrix or untransformed positions in the fragment shader). |
40 */ | 40 */ |
41 static GrFragmentProcessor* Create(GrPrimitiveEdgeType edgeType, int n, | 41 static GrFragmentProcessor* Create(GrPrimitiveEdgeType edgeType, int n, |
42 const SkScalar edges[]) { | 42 const SkScalar edges[]) { |
43 if (n <= 0 || n > kMaxEdges || kHairlineAA_GrProcessorEdgeType == edgeTy
pe) { | 43 if (n <= 0 || n > kMaxEdges || kHairlineAA_GrProcessorEdgeType == edgeTy
pe) { |
44 return NULL; | 44 return nullptr; |
45 } | 45 } |
46 return new GrConvexPolyEffect(edgeType, n, edges); | 46 return new GrConvexPolyEffect(edgeType, n, edges); |
47 } | 47 } |
48 | 48 |
49 /** | 49 /** |
50 * Creates an effect that clips against the path. If the path is not a conve
x polygon, is | 50 * Creates an effect that clips against the path. If the path is not a conve
x polygon, is |
51 * inverse filled, or has too many edges, this will return NULL. If offset i
s non-NULL, then | 51 * inverse filled, or has too many edges, this will return nullptr. If offse
t is non-nullptr, then |
52 * the path is translated by the vector. | 52 * the path is translated by the vector. |
53 */ | 53 */ |
54 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkPath&, | 54 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkPath&, |
55 const SkVector* offset = NULL); | 55 const SkVector* offset = nullptr); |
56 | 56 |
57 /** | 57 /** |
58 * Creates an effect that fills inside the rect with AA edges.. | 58 * Creates an effect that fills inside the rect with AA edges.. |
59 */ | 59 */ |
60 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRect&); | 60 static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRect&); |
61 | 61 |
62 virtual ~GrConvexPolyEffect(); | 62 virtual ~GrConvexPolyEffect(); |
63 | 63 |
64 const char* name() const override { return "ConvexPoly"; } | 64 const char* name() const override { return "ConvexPoly"; } |
65 | 65 |
(...skipping 18 matching lines...) Expand all Loading... |
84 int fEdgeCount; | 84 int fEdgeCount; |
85 SkScalar fEdges[3 * kMaxEdges]; | 85 SkScalar fEdges[3 * kMaxEdges]; |
86 | 86 |
87 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 87 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
88 | 88 |
89 typedef GrFragmentProcessor INHERITED; | 89 typedef GrFragmentProcessor INHERITED; |
90 }; | 90 }; |
91 | 91 |
92 | 92 |
93 #endif | 93 #endif |
OLD | NEW |