OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 init.getOverrideColorIfSet(&fGeoData[0].fColor); | 243 init.getOverrideColorIfSet(&fGeoData[0].fColor); |
244 | 244 |
245 // setup batch properties | 245 // setup batch properties |
246 fBatch.fColorIgnored = !init.readsColor(); | 246 fBatch.fColorIgnored = !init.readsColor(); |
247 fBatch.fColor = fGeoData[0].fColor; | 247 fBatch.fColor = fGeoData[0].fColor; |
248 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 248 fBatch.fUsesLocalCoords = init.readsLocalCoords(); |
249 fBatch.fCoverageIgnored = !init.readsCoverage(); | 249 fBatch.fCoverageIgnored = !init.readsCoverage(); |
250 } | 250 } |
251 | 251 |
252 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 252 void generateGeometry(GrBatchTarget* batchTarget) override { |
253 SkAutoTUnref<const GrGeometryProcessor> gp; | 253 SkAutoTUnref<const GrGeometryProcessor> gp; |
254 { | 254 { |
255 using namespace GrDefaultGeoProcFactory; | 255 using namespace GrDefaultGeoProcFactory; |
256 Color color(this->color()); | 256 Color color(this->color()); |
257 Coverage coverage(this->coverage()); | 257 Coverage coverage(this->coverage()); |
258 if (this->coverageIgnored()) { | 258 if (this->coverageIgnored()) { |
259 coverage.fType = Coverage::kNone_Type; | 259 coverage.fType = Coverage::kNone_Type; |
260 } | 260 } |
261 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP
osition_Type : | 261 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP
osition_Type : |
262 LocalCoords::kUnus
ed_Type); | 262 LocalCoords::kUnus
ed_Type); |
263 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord
s, | 263 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord
s, |
264 this->viewMatrix())); | 264 this->viewMatrix())); |
265 } | 265 } |
266 | 266 |
267 size_t vertexStride = gp->getVertexStride(); | 267 size_t vertexStride = gp->getVertexStride(); |
268 SkASSERT(vertexStride == sizeof(SkPoint)); | 268 SkASSERT(vertexStride == sizeof(SkPoint)); |
269 | 269 |
270 batchTarget->initDraw(gp, pipeline); | 270 batchTarget->initDraw(gp, this->pipeline()); |
271 | 271 |
272 int instanceCount = fGeoData.count(); | 272 int instanceCount = fGeoData.count(); |
273 | 273 |
274 // compute number of vertices | 274 // compute number of vertices |
275 int maxVertices = 0; | 275 int maxVertices = 0; |
276 | 276 |
277 // We will use index buffers if we have multiple paths or one path with
multiple contours | 277 // We will use index buffers if we have multiple paths or one path with
multiple contours |
278 bool isIndexed = instanceCount > 1; | 278 bool isIndexed = instanceCount > 1; |
279 for (int i = 0; i < instanceCount; i++) { | 279 for (int i = 0; i < instanceCount; i++) { |
280 Geometry& args = fGeoData[i]; | 280 Geometry& args = fGeoData[i]; |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 geometry.fColor = color; | 753 geometry.fColor = color; |
754 geometry.fPath = path; | 754 geometry.fPath = path; |
755 geometry.fTolerance = srcSpaceTol; | 755 geometry.fTolerance = srcSpaceTol; |
756 | 756 |
757 viewMatrix.mapRect(&bounds); | 757 viewMatrix.mapRect(&bounds); |
758 uint8_t coverage = GrRandomCoverage(random); | 758 uint8_t coverage = GrRandomCoverage(random); |
759 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 759 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
760 } | 760 } |
761 | 761 |
762 #endif | 762 #endif |
OLD | NEW |