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 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 /** Specifies that "inside" is computed by a non-zero sum of signed | 70 /** Specifies that "inside" is computed by a non-zero sum of signed |
71 edge crossings | 71 edge crossings |
72 */ | 72 */ |
73 kWinding_FillType, | 73 kWinding_FillType, |
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 static const GrUserStencilSettings& GetStencilPassSettings(FillType); |
| 81 |
80 /** | 82 /** |
81 * Creates a new gpu path, based on the specified path and stroke and return
s it. | 83 * 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. | 84 * The caller owns a ref on the returned path which must be balanced by a ca
ll to unref. |
83 * | 85 * |
84 * @param SkPath the geometry. | 86 * @param SkPath the geometry. |
85 * @param GrStyle the style applied to the path. Styles with non-dash path
effects are not | 87 * @param GrStyle the style applied to the path. Styles with non-dash path
effects are not |
86 * allowed. | 88 * allowed. |
87 * @return a new GPU path object. | 89 * @return a new GPU path object. |
88 */ | 90 */ |
89 virtual GrPath* createPath(const SkPath&, const GrStyle&) = 0; | 91 virtual GrPath* createPath(const SkPath&, const GrStyle&) = 0; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 const GrStencilSettings* fStencil; | 152 const GrStencilSettings* fStencil; |
151 }; | 153 }; |
152 | 154 |
153 void stencilPath(const StencilPathArgs& args, const GrPath* path) { | 155 void stencilPath(const StencilPathArgs& args, const GrPath* path) { |
154 fGpu->handleDirtyContext(); | 156 fGpu->handleDirtyContext(); |
155 this->onStencilPath(args, path); | 157 this->onStencilPath(args, path); |
156 } | 158 } |
157 | 159 |
158 void drawPath(const GrPipeline& pipeline, | 160 void drawPath(const GrPipeline& pipeline, |
159 const GrPrimitiveProcessor& primProc, | 161 const GrPrimitiveProcessor& primProc, |
160 const GrStencilSettings& stencil, | 162 const GrStencilSettings& stencilPassSettings, // Cover pass se
ttings in pipeline. |
161 const GrPath* path) { | 163 const GrPath* path) { |
162 fGpu->handleDirtyContext(); | 164 fGpu->handleDirtyContext(); |
163 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { | 165 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { |
164 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); | 166 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); |
165 } | 167 } |
166 this->onDrawPath(pipeline, primProc, stencil, path); | 168 this->onDrawPath(pipeline, primProc, stencilPassSettings, path); |
167 } | 169 } |
168 | 170 |
169 void drawPaths(const GrPipeline& pipeline, | 171 void drawPaths(const GrPipeline& pipeline, |
170 const GrPrimitiveProcessor& primProc, | 172 const GrPrimitiveProcessor& primProc, |
171 const GrStencilSettings& stencil, | 173 const GrStencilSettings& stencilPassSettings, // Cover pass s
ettings in pipeline. |
172 const GrPathRange* pathRange, | 174 const GrPathRange* pathRange, |
173 const void* indices, | 175 const void* indices, |
174 PathIndexType indexType, | 176 PathIndexType indexType, |
175 const float transformValues[], | 177 const float transformValues[], |
176 PathTransformType transformType, | 178 PathTransformType transformType, |
177 int count) { | 179 int count) { |
178 fGpu->handleDirtyContext(); | 180 fGpu->handleDirtyContext(); |
179 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { | 181 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { |
180 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); | 182 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); |
181 } | 183 } |
182 #ifdef SK_DEBUG | 184 #ifdef SK_DEBUG |
183 pathRange->assertPathsLoaded(indices, indexType, count); | 185 pathRange->assertPathsLoaded(indices, indexType, count); |
184 #endif | 186 #endif |
185 this->onDrawPaths(pipeline, primProc, stencil, pathRange, indices, index
Type, | 187 this->onDrawPaths(pipeline, primProc, stencilPassSettings, pathRange, in
dices, indexType, |
186 transformValues, transformType, count); | 188 transformValues, transformType, count); |
187 } | 189 } |
188 | 190 |
189 protected: | 191 protected: |
190 GrPathRendering(GrGpu* gpu) | 192 GrPathRendering(GrGpu* gpu) |
191 : fGpu(gpu) { | 193 : fGpu(gpu) { |
192 } | 194 } |
193 virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; | 195 virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; |
194 virtual void onDrawPath(const GrPipeline&, | 196 virtual void onDrawPath(const GrPipeline&, |
195 const GrPrimitiveProcessor&, | 197 const GrPrimitiveProcessor&, |
196 const GrStencilSettings&, | 198 const GrStencilSettings&, |
197 const GrPath*) = 0; | 199 const GrPath*) = 0; |
198 virtual void onDrawPaths(const GrPipeline&, | 200 virtual void onDrawPaths(const GrPipeline&, |
199 const GrPrimitiveProcessor&, | 201 const GrPrimitiveProcessor&, |
200 const GrStencilSettings&, | 202 const GrStencilSettings&, |
201 const GrPathRange*, | 203 const GrPathRange*, |
202 const void* indices, | 204 const void* indices, |
203 PathIndexType, | 205 PathIndexType, |
204 const float transformValues[], | 206 const float transformValues[], |
205 PathTransformType, | 207 PathTransformType, |
206 int count) = 0; | 208 int count) = 0; |
207 | 209 |
208 GrGpu* fGpu; | 210 GrGpu* fGpu; |
209 private: | 211 private: |
210 GrPathRendering& operator=(const GrPathRendering&); | 212 GrPathRendering& operator=(const GrPathRendering&); |
211 }; | 213 }; |
212 | 214 |
213 #endif | 215 #endif |
OLD | NEW |