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 GrStyle; | 20 class GrStrokeInfo; |
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 geometry. | 84 * @param skPath the path geometry. |
85 * @param GrStyle the style applied to the path. Styles with non-dash path
effects are not | 85 * @param stroke the path stroke. |
86 * allowed. | 86 * @return a new path. |
87 * @return a new GPU path object. | |
88 */ | 87 */ |
89 virtual GrPath* createPath(const SkPath&, const GrStyle&) = 0; | 88 virtual GrPath* createPath(const SkPath&, const GrStrokeInfo&) = 0; |
90 | 89 |
91 /** | 90 /** |
92 * Creates a range of gpu paths with a common style. The caller owns a ref o
n the | 91 * Creates a range of gpu paths with a common stroke. The caller owns a ref
on the |
93 * returned path range which must be balanced by a call to unref. | 92 * returned path range which must be balanced by a call to unref. |
94 * | 93 * |
95 * @param PathGenerator class that generates SkPath objects for each path in
the range. | 94 * @param PathGenerator class that generates SkPath objects for each path in
the range. |
96 * @param GrStyle the common style applied to each path in the range. Styl
es with non-dash | 95 * @param GrStrokeInfo the common stroke applied to each path in the range
. |
97 * path effects are not allowed. | |
98 * @return a new path range. | 96 * @return a new path range. |
99 */ | 97 */ |
100 virtual GrPathRange* createPathRange(GrPathRange::PathGenerator*, const GrSt
yle&) = 0; | 98 virtual GrPathRange* createPathRange(GrPathRange::PathGenerator*, const GrSt
rokeInfo&) = 0; |
101 | 99 |
102 /** | 100 /** |
103 * Creates a range of glyph paths, indexed by glyph id. The glyphs will have
an | 101 * Creates a range of glyph paths, indexed by glyph id. The glyphs will have
an |
104 * inverted y-direction in order to match the raw font path data. The caller
owns | 102 * inverted y-direction in order to match the raw font path data. The caller
owns |
105 * a ref on the returned path range which must be balanced by a call to unre
f. | 103 * a ref on the returned path range which must be balanced by a call to unre
f. |
106 * | 104 * |
107 * @param SkTypeface Typeface that defines the glyphs. | 105 * @param SkTypeface Typeface that defines the glyphs. |
108 * If null, the default typeface will be used. | 106 * If null, the default typeface will be used. |
109 * | 107 * |
110 * @param SkDescriptor Additional font configuration that specifies the font
's size, | 108 * @param SkDescriptor Additional font configuration that specifies the font
's size, |
111 * stroke, and other flags. This will generally come fro
m an | 109 * stroke, and other flags. This will generally come fro
m an |
112 * SkGlyphCache. | 110 * SkGlyphCache. |
113 * | 111 * |
114 * It is recommended to leave this value null when possi
ble, in | 112 * It is recommended to leave this value null when possi
ble, in |
115 * which case the glyphs will be loaded directly from th
e font's | 113 * which case the glyphs will be loaded directly from th
e font's |
116 * raw path data and sized at SkPaint::kCanonicalTextSiz
eForPaths. | 114 * raw path data and sized at SkPaint::kCanonicalTextSiz
eForPaths. |
117 * This will result in less memory usage and more effici
ent paths. | 115 * This will result in less memory usage and more effici
ent paths. |
118 * | 116 * |
119 * If non-null, the glyph paths will match the font desc
riptor, | 117 * If non-null, the glyph paths will match the font desc
riptor, |
120 * including with the stroke information baked directly
into | 118 * including with the stroke information baked directly
into |
121 * the outlines. | 119 * the outlines. |
122 * | 120 * |
123 * @param GrStyle Common style that the GPU will apply to every path. N
ote that | 121 * @param GrStrokeInfo Common stroke that the GPU will apply to every path.
Note that |
124 * if the glyph outlines contain baked-in styles from th
e font | 122 * if the glyph outlines contain baked-in strokes from t
he font |
125 * descriptor, the GPU style will be applied on top of t
hose | 123 * descriptor, the GPU stroke will be applied on top of
those |
126 * outlines. | 124 * outlines. |
127 * | 125 * |
128 * @return a new path range populated with glyphs. | 126 * @return a new path range populated with glyphs. |
129 */ | 127 */ |
130 GrPathRange* createGlyphs(const SkTypeface*, const SkScalerContextEffects&, | 128 GrPathRange* createGlyphs(const SkTypeface*, const SkScalerContextEffects&, |
131 const SkDescriptor*, const GrStyle&); | 129 const SkDescriptor*, const GrStrokeInfo&); |
132 | 130 |
133 /** None of these params are optional, pointers used just to avoid making co
pies. */ | 131 /** None of these params are optional, pointers used just to avoid making co
pies. */ |
134 struct StencilPathArgs { | 132 struct StencilPathArgs { |
135 StencilPathArgs(bool useHWAA, | 133 StencilPathArgs(bool useHWAA, |
136 GrRenderTarget* renderTarget, | 134 GrRenderTarget* renderTarget, |
137 const SkMatrix* viewMatrix, | 135 const SkMatrix* viewMatrix, |
138 const GrScissorState* scissor, | 136 const GrScissorState* scissor, |
139 const GrStencilSettings* stencil) | 137 const GrStencilSettings* stencil) |
140 : fUseHWAA(useHWAA) | 138 : fUseHWAA(useHWAA) |
141 , fRenderTarget(renderTarget) | 139 , fRenderTarget(renderTarget) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 const float transformValues[], | 202 const float transformValues[], |
205 PathTransformType, | 203 PathTransformType, |
206 int count) = 0; | 204 int count) = 0; |
207 | 205 |
208 GrGpu* fGpu; | 206 GrGpu* fGpu; |
209 private: | 207 private: |
210 GrPathRendering& operator=(const GrPathRendering&); | 208 GrPathRendering& operator=(const GrPathRendering&); |
211 }; | 209 }; |
212 | 210 |
213 #endif | 211 #endif |
OLD | NEW |