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.readsColor()) { | 240 if (init.fColorIgnored) { |
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; |
242 } | 244 } |
243 init.getOverrideColorIfSet(&fGeoData[0].fColor); | |
244 | 245 |
245 // setup batch properties | 246 // setup batch properties |
246 fBatch.fColorIgnored = !init.readsColor(); | 247 fBatch.fColorIgnored = init.fColorIgnored; |
247 fBatch.fColor = fGeoData[0].fColor; | 248 fBatch.fColor = fGeoData[0].fColor; |
248 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 249 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; |
249 fBatch.fCoverageIgnored = !init.readsCoverage(); | 250 fBatch.fCoverageIgnored = init.fCoverageIgnored; |
250 } | 251 } |
251 | 252 |
252 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 253 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
253 SkAutoTUnref<const GrGeometryProcessor> gp( | 254 SkAutoTUnref<const GrGeometryProcessor> gp( |
254 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, | 255 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, |
255 this->color(), | 256 this->color(), |
256 this->usesLocalCoords(), | 257 this->usesLocalCoords(), |
257 this->coverageIgnored(), | 258 this->coverageIgnored(), |
258 this->viewMatrix(), | 259 this->viewMatrix(), |
259 SkMatrix::I(), | 260 SkMatrix::I(), |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 geometry.fColor = color; | 759 geometry.fColor = color; |
759 geometry.fPath = path; | 760 geometry.fPath = path; |
760 geometry.fTolerance = srcSpaceTol; | 761 geometry.fTolerance = srcSpaceTol; |
761 | 762 |
762 viewMatrix.mapRect(&bounds); | 763 viewMatrix.mapRect(&bounds); |
763 uint8_t coverage = GrRandomCoverage(random); | 764 uint8_t coverage = GrRandomCoverage(random); |
764 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 765 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
765 } | 766 } |
766 | 767 |
767 #endif | 768 #endif |
OLD | NEW |