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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, const GrPipeline* pipeline
) override { |
253 SkAutoTUnref<const GrGeometryProcessor> gp( | 253 SkAutoTUnref<const GrGeometryProcessor> gp; |
254 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, | 254 { |
255 this->color(), | 255 using namespace GrDefaultGeoProcFactory; |
256 this->usesLocalCoords(), | 256 Color color(this->color()); |
257 this->coverageIgnored(), | 257 Coverage coverage(this->coverage()); |
258 this->viewMatrix(), | 258 if (this->coverageIgnored()) { |
259 SkMatrix::I(), | 259 coverage.fType = Coverage::kNone_Type; |
260 this->coverage())); | 260 } |
| 261 LocalCoords localCoords(this->usesLocalCoords() ? LocalCoords::kUseP
osition_Type : |
| 262 LocalCoords::kUnus
ed_Type); |
| 263 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord
s, |
| 264 this->viewMatrix())); |
| 265 } |
261 | 266 |
262 size_t vertexStride = gp->getVertexStride(); | 267 size_t vertexStride = gp->getVertexStride(); |
263 SkASSERT(vertexStride == sizeof(SkPoint)); | 268 SkASSERT(vertexStride == sizeof(SkPoint)); |
264 | 269 |
265 batchTarget->initDraw(gp, pipeline); | 270 batchTarget->initDraw(gp, pipeline); |
266 | 271 |
267 int instanceCount = fGeoData.count(); | 272 int instanceCount = fGeoData.count(); |
268 | 273 |
269 // compute number of vertices | 274 // compute number of vertices |
270 int maxVertices = 0; | 275 int maxVertices = 0; |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 geometry.fColor = color; | 753 geometry.fColor = color; |
749 geometry.fPath = path; | 754 geometry.fPath = path; |
750 geometry.fTolerance = srcSpaceTol; | 755 geometry.fTolerance = srcSpaceTol; |
751 | 756 |
752 viewMatrix.mapRect(&bounds); | 757 viewMatrix.mapRect(&bounds); |
753 uint8_t coverage = GrRandomCoverage(random); | 758 uint8_t coverage = GrRandomCoverage(random); |
754 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 759 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
755 } | 760 } |
756 | 761 |
757 #endif | 762 #endif |
OLD | NEW |