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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 230 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
231 // When this is called on a batch, there is only one geometry bundle | 231 // When this is called on a batch, there is only one geometry bundle |
232 out->setKnownFourComponents(fGeoData[0].fColor); | 232 out->setKnownFourComponents(fGeoData[0].fColor); |
233 } | 233 } |
234 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 234 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
235 out->setKnownSingleComponent(this->coverage()); | 235 out->setKnownSingleComponent(this->coverage()); |
236 } | 236 } |
237 | 237 |
238 void initBatchTracker(const GrPipelineInfo& init) override { | 238 void initBatchTracker(const GrPipelineInfo& init) override { |
239 // Handle any color overrides | 239 // Handle any color overrides |
240 if (init.fColorIgnored) { | 240 if (!init.readsColor()) { |
241 fGeoData[0].fColor = GrColor_ILLEGAL; | 241 fGeoData[0].fColor = GrColor_ILLEGAL; |
242 } else if (GrColor_ILLEGAL != init.fOverrideColor) { | |
243 fGeoData[0].fColor = init.fOverrideColor; | |
244 } | 242 } |
| 243 init.getOverrideColorIfSet(&fGeoData[0].fColor); |
245 | 244 |
246 // setup batch properties | 245 // setup batch properties |
247 fBatch.fColorIgnored = init.fColorIgnored; | 246 fBatch.fColorIgnored = !init.readsColor(); |
248 fBatch.fColor = fGeoData[0].fColor; | 247 fBatch.fColor = fGeoData[0].fColor; |
249 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; | 248 fBatch.fUsesLocalCoords = init.readsLocalCoords(); |
250 fBatch.fCoverageIgnored = init.fCoverageIgnored; | 249 fBatch.fCoverageIgnored = !init.readsCoverage(); |
251 } | 250 } |
252 | 251 |
253 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 252 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
254 SkAutoTUnref<const GrGeometryProcessor> gp( | 253 SkAutoTUnref<const GrGeometryProcessor> gp( |
255 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, | 254 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, |
256 this->color(), | 255 this->color(), |
257 this->usesLocalCoords(), | 256 this->usesLocalCoords(), |
258 this->coverageIgnored(), | 257 this->coverageIgnored(), |
259 this->viewMatrix(), | 258 this->viewMatrix(), |
260 SkMatrix::I(), | 259 SkMatrix::I(), |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 geometry.fColor = color; | 758 geometry.fColor = color; |
760 geometry.fPath = path; | 759 geometry.fPath = path; |
761 geometry.fTolerance = srcSpaceTol; | 760 geometry.fTolerance = srcSpaceTol; |
762 | 761 |
763 viewMatrix.mapRect(&bounds); | 762 viewMatrix.mapRect(&bounds); |
764 uint8_t coverage = GrRandomCoverage(random); | 763 uint8_t coverage = GrRandomCoverage(random); |
765 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 764 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
766 } | 765 } |
767 | 766 |
768 #endif | 767 #endif |
OLD | NEW |