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

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

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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
« no previous file with comments | « src/gpu/effects/GrConstColorProcessor.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
(...skipping 20 matching lines...) Expand all
31 * edges is a set of n edge equations where n is limited to kMaxEdges. It co ntains 3*n values. 31 * edges is a set of n edge equations where n is limited to kMaxEdges. It co ntains 3*n values.
32 * The edges should form a convex polygon. The positive half-plane is consid ered to be the 32 * The edges should form a convex polygon. The positive half-plane is consid ered to be the
33 * inside. The equations should be normalized such that the first two coeffi cients are a unit 33 * inside. The equations should be normalized such that the first two coeffi cients are a unit
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 sk_sp<GrFragmentProcessor> Make(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 nullptr; 44 return nullptr;
45 } 45 }
46 return new GrConvexPolyEffect(edgeType, n, edges); 46 return sk_sp<GrFragmentProcessor>(new GrConvexPolyEffect(edgeType, n, ed ges));
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 nullptr. If offse t is non-nullptr, 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 sk_sp<GrFragmentProcessor> Make(GrPrimitiveEdgeType, const SkPath&,
55 const SkVector* offset = nullptr); 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 sk_sp<GrFragmentProcessor> Make(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
66 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; } 66 GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
67 67
68 int getEdgeCount() const { return fEdgeCount; } 68 int getEdgeCount() const { return fEdgeCount; }
69 69
70 const SkScalar* getEdges() const { return fEdges; } 70 const SkScalar* getEdges() const { return fEdges; }
(...skipping 13 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « src/gpu/effects/GrConstColorProcessor.cpp ('k') | src/gpu/effects/GrConvexPolyEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698