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 GrPathRendering_DEFINED | 8 #ifndef GrPathRendering_DEFINED |
9 #define GrPathRendering_DEFINED | 9 #define GrPathRendering_DEFINED |
10 | 10 |
11 #include "SkPath.h" | 11 #include "SkPath.h" |
12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
13 #include "GrPathRange.h" | 13 #include "GrPathRange.h" |
14 #include "GrPipeline.h" | 14 #include "GrPipeline.h" |
15 | 15 |
16 class SkDescriptor; | 16 class SkDescriptor; |
17 class SkTypeface; | 17 class SkTypeface; |
18 class GrPath; | 18 class GrPath; |
19 class GrStencilSettings; | 19 class GrStencilSettings; |
20 class GrStrokeInfo; | 20 class GrStyle; |
21 | 21 |
22 /** | 22 /** |
23 * Abstract class wrapping HW path rendering API. | 23 * Abstract class wrapping HW path rendering API. |
24 * | 24 * |
25 * The subclasses of this class use the possible HW API to render paths (as oppo
sed to path | 25 * The subclasses of this class use the possible HW API to render paths (as oppo
sed to path |
26 * rendering implemented in Skia on top of a "3d" HW API). | 26 * rendering implemented in Skia on top of a "3d" HW API). |
27 * The subclasses hold the global state needed to render paths, including shadow
of the global HW | 27 * The subclasses hold the global state needed to render paths, including shadow
of the global HW |
28 * API state. Similar to GrGpu. | 28 * API state. Similar to GrGpu. |
29 * | 29 * |
30 * It is expected that the lifetimes of GrGpuXX and GrXXPathRendering are the sa
me. The call context | 30 * It is expected that the lifetimes of GrGpuXX and GrXXPathRendering are the sa
me. The call context |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 /** Specifies that "inside" is computed by an odd number of edge | 74 /** Specifies that "inside" is computed by an odd number of edge |
75 crossings | 75 crossings |
76 */ | 76 */ |
77 kEvenOdd_FillType, | 77 kEvenOdd_FillType, |
78 }; | 78 }; |
79 | 79 |
80 /** | 80 /** |
81 * Creates a new gpu path, based on the specified path and stroke and return
s it. | 81 * Creates a new gpu path, based on the specified path and stroke and return
s it. |
82 * The caller owns a ref on the returned path which must be balanced by a ca
ll to unref. | 82 * The caller owns a ref on the returned path which must be balanced by a ca
ll to unref. |
83 * | 83 * |
84 * @param skPath the path geometry. | 84 * @param SkPath the geometry. |
85 * @param stroke the path stroke. | 85 * @param GrStyle the style applied to the path. Styles with non-dash path
effects are not |
86 * @return a new path. | 86 * allowed. |
| 87 * @return a new GPU path object. |
87 */ | 88 */ |
88 virtual GrPath* createPath(const SkPath&, const GrStrokeInfo&) = 0; | 89 virtual GrPath* createPath(const SkPath&, const GrStyle&) = 0; |
89 | 90 |
90 /** | 91 /** |
91 * Creates a range of gpu paths with a common stroke. The caller owns a ref
on the | 92 * Creates a range of gpu paths with a common style. The caller owns a ref o
n the |
92 * returned path range which must be balanced by a call to unref. | 93 * returned path range which must be balanced by a call to unref. |
93 * | 94 * |
94 * @param PathGenerator class that generates SkPath objects for each path in
the range. | 95 * @param PathGenerator class that generates SkPath objects for each path in
the range. |
95 * @param GrStrokeInfo the common stroke applied to each path in the range
. | 96 * @param GrStyle the common style applied to each path in the range. Styl
es with non-dash |
| 97 * path effects are not allowed. |
96 * @return a new path range. | 98 * @return a new path range. |
97 */ | 99 */ |
98 virtual GrPathRange* createPathRange(GrPathRange::PathGenerator*, const GrSt
rokeInfo&) = 0; | 100 virtual GrPathRange* createPathRange(GrPathRange::PathGenerator*, const GrSt
yle&) = 0; |
99 | 101 |
100 /** | 102 /** |
101 * Creates a range of glyph paths, indexed by glyph id. The glyphs will have
an | 103 * Creates a range of glyph paths, indexed by glyph id. The glyphs will have
an |
102 * inverted y-direction in order to match the raw font path data. The caller
owns | 104 * inverted y-direction in order to match the raw font path data. The caller
owns |
103 * a ref on the returned path range which must be balanced by a call to unre
f. | 105 * a ref on the returned path range which must be balanced by a call to unre
f. |
104 * | 106 * |
105 * @param SkTypeface Typeface that defines the glyphs. | 107 * @param SkTypeface Typeface that defines the glyphs. |
106 * If null, the default typeface will be used. | 108 * If null, the default typeface will be used. |
107 * | 109 * |
108 * @param SkDescriptor Additional font configuration that specifies the font
's size, | 110 * @param SkDescriptor Additional font configuration that specifies the font
's size, |
109 * stroke, and other flags. This will generally come fro
m an | 111 * stroke, and other flags. This will generally come fro
m an |
110 * SkGlyphCache. | 112 * SkGlyphCache. |
111 * | 113 * |
112 * It is recommended to leave this value null when possi
ble, in | 114 * It is recommended to leave this value null when possi
ble, in |
113 * which case the glyphs will be loaded directly from th
e font's | 115 * which case the glyphs will be loaded directly from th
e font's |
114 * raw path data and sized at SkPaint::kCanonicalTextSiz
eForPaths. | 116 * raw path data and sized at SkPaint::kCanonicalTextSiz
eForPaths. |
115 * This will result in less memory usage and more effici
ent paths. | 117 * This will result in less memory usage and more effici
ent paths. |
116 * | 118 * |
117 * If non-null, the glyph paths will match the font desc
riptor, | 119 * If non-null, the glyph paths will match the font desc
riptor, |
118 * including with the stroke information baked directly
into | 120 * including with the stroke information baked directly
into |
119 * the outlines. | 121 * the outlines. |
120 * | 122 * |
121 * @param GrStrokeInfo Common stroke that the GPU will apply to every path.
Note that | 123 * @param GrStyle Common style that the GPU will apply to every path. N
ote that |
122 * if the glyph outlines contain baked-in strokes from t
he font | 124 * if the glyph outlines contain baked-in styles from th
e font |
123 * descriptor, the GPU stroke will be applied on top of
those | 125 * descriptor, the GPU style will be applied on top of t
hose |
124 * outlines. | 126 * outlines. |
125 * | 127 * |
126 * @return a new path range populated with glyphs. | 128 * @return a new path range populated with glyphs. |
127 */ | 129 */ |
128 GrPathRange* createGlyphs(const SkTypeface*, const SkScalerContextEffects&, | 130 GrPathRange* createGlyphs(const SkTypeface*, const SkScalerContextEffects&, |
129 const SkDescriptor*, const GrStrokeInfo&); | 131 const SkDescriptor*, const GrStyle&); |
130 | 132 |
131 /** None of these params are optional, pointers used just to avoid making co
pies. */ | 133 /** None of these params are optional, pointers used just to avoid making co
pies. */ |
132 struct StencilPathArgs { | 134 struct StencilPathArgs { |
133 StencilPathArgs(bool useHWAA, | 135 StencilPathArgs(bool useHWAA, |
134 GrRenderTarget* renderTarget, | 136 GrRenderTarget* renderTarget, |
135 const SkMatrix* viewMatrix, | 137 const SkMatrix* viewMatrix, |
136 const GrScissorState* scissor, | 138 const GrScissorState* scissor, |
137 const GrStencilSettings* stencil) | 139 const GrStencilSettings* stencil) |
138 : fUseHWAA(useHWAA) | 140 : fUseHWAA(useHWAA) |
139 , fRenderTarget(renderTarget) | 141 , fRenderTarget(renderTarget) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 const float transformValues[], | 204 const float transformValues[], |
203 PathTransformType, | 205 PathTransformType, |
204 int count) = 0; | 206 int count) = 0; |
205 | 207 |
206 GrGpu* fGpu; | 208 GrGpu* fGpu; |
207 private: | 209 private: |
208 GrPathRendering& operator=(const GrPathRendering&); | 210 GrPathRendering& operator=(const GrPathRendering&); |
209 }; | 211 }; |
210 | 212 |
211 #endif | 213 #endif |
OLD | NEW |