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