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 path geometry. | 86 * @param skPath the path geometry. |
85 * @param stroke the path stroke. | 87 * @param stroke the path stroke. |
86 * @return a new path. | 88 * @return a new path. |
87 */ | 89 */ |
88 virtual GrPath* createPath(const SkPath&, const GrStrokeInfo&) = 0; | 90 virtual GrPath* createPath(const SkPath&, const GrStrokeInfo&) = 0; |
89 | 91 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 const GrStencilSettings* fStencil; | 150 const GrStencilSettings* fStencil; |
149 }; | 151 }; |
150 | 152 |
151 void stencilPath(const StencilPathArgs& args, const GrPath* path) { | 153 void stencilPath(const StencilPathArgs& args, const GrPath* path) { |
152 fGpu->handleDirtyContext(); | 154 fGpu->handleDirtyContext(); |
153 this->onStencilPath(args, path); | 155 this->onStencilPath(args, path); |
154 } | 156 } |
155 | 157 |
156 void drawPath(const GrPipeline& pipeline, | 158 void drawPath(const GrPipeline& pipeline, |
157 const GrPrimitiveProcessor& primProc, | 159 const GrPrimitiveProcessor& primProc, |
158 const GrStencilSettings& stencil, | 160 const GrStencilSettings& stencilPassSettings, // Cover pass se
ttings in pipeline. |
159 const GrPath* path) { | 161 const GrPath* path) { |
160 fGpu->handleDirtyContext(); | 162 fGpu->handleDirtyContext(); |
161 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { | 163 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { |
162 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); | 164 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); |
163 } | 165 } |
164 this->onDrawPath(pipeline, primProc, stencil, path); | 166 this->onDrawPath(pipeline, primProc, stencilPassSettings, path); |
165 } | 167 } |
166 | 168 |
167 void drawPaths(const GrPipeline& pipeline, | 169 void drawPaths(const GrPipeline& pipeline, |
168 const GrPrimitiveProcessor& primProc, | 170 const GrPrimitiveProcessor& primProc, |
169 const GrStencilSettings& stencil, | 171 const GrStencilSettings& stencilPassSettings, // Cover pass s
ettings in pipeline. |
170 const GrPathRange* pathRange, | 172 const GrPathRange* pathRange, |
171 const void* indices, | 173 const void* indices, |
172 PathIndexType indexType, | 174 PathIndexType indexType, |
173 const float transformValues[], | 175 const float transformValues[], |
174 PathTransformType transformType, | 176 PathTransformType transformType, |
175 int count) { | 177 int count) { |
176 fGpu->handleDirtyContext(); | 178 fGpu->handleDirtyContext(); |
177 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { | 179 if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*fGpu->caps
())) { |
178 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); | 180 fGpu->xferBarrier(pipeline.getRenderTarget(), barrierType); |
179 } | 181 } |
180 #ifdef SK_DEBUG | 182 #ifdef SK_DEBUG |
181 pathRange->assertPathsLoaded(indices, indexType, count); | 183 pathRange->assertPathsLoaded(indices, indexType, count); |
182 #endif | 184 #endif |
183 this->onDrawPaths(pipeline, primProc, stencil, pathRange, indices, index
Type, | 185 this->onDrawPaths(pipeline, primProc, stencilPassSettings, pathRange, in
dices, indexType, |
184 transformValues, transformType, count); | 186 transformValues, transformType, count); |
185 } | 187 } |
186 | 188 |
187 protected: | 189 protected: |
188 GrPathRendering(GrGpu* gpu) | 190 GrPathRendering(GrGpu* gpu) |
189 : fGpu(gpu) { | 191 : fGpu(gpu) { |
190 } | 192 } |
191 virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; | 193 virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; |
192 virtual void onDrawPath(const GrPipeline&, | 194 virtual void onDrawPath(const GrPipeline&, |
193 const GrPrimitiveProcessor&, | 195 const GrPrimitiveProcessor&, |
194 const GrStencilSettings&, | 196 const GrStencilSettings&, |
195 const GrPath*) = 0; | 197 const GrPath*) = 0; |
196 virtual void onDrawPaths(const GrPipeline&, | 198 virtual void onDrawPaths(const GrPipeline&, |
197 const GrPrimitiveProcessor&, | 199 const GrPrimitiveProcessor&, |
198 const GrStencilSettings&, | 200 const GrStencilSettings&, |
199 const GrPathRange*, | 201 const GrPathRange*, |
200 const void* indices, | 202 const void* indices, |
201 PathIndexType, | 203 PathIndexType, |
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 |