OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAARectRenderer.h" | 9 #include "GrAARectRenderer.h" |
10 #include "GrAtlasTextContext.h" | 10 #include "GrAtlasTextContext.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // When this is called on a batch, there is only one geometry bundle | 268 // When this is called on a batch, there is only one geometry bundle |
269 out->setKnownFourComponents(fGeoData[0].fColor); | 269 out->setKnownFourComponents(fGeoData[0].fColor); |
270 } | 270 } |
271 | 271 |
272 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 272 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
273 out->setKnownSingleComponent(0xff); | 273 out->setKnownSingleComponent(0xff); |
274 } | 274 } |
275 | 275 |
276 void initBatchTracker(const GrPipelineInfo& init) override { | 276 void initBatchTracker(const GrPipelineInfo& init) override { |
277 // Handle any color overrides | 277 // Handle any color overrides |
278 if (!init.readsColor()) { | 278 if (init.fColorIgnored) { |
279 fGeoData[0].fColor = GrColor_ILLEGAL; | 279 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 280 } else if (GrColor_ILLEGAL != init.fOverrideColor) { |
| 281 fGeoData[0].fColor = init.fOverrideColor; |
280 } | 282 } |
281 init.getOverrideColorIfSet(&fGeoData[0].fColor); | |
282 | 283 |
283 // setup batch properties | 284 // setup batch properties |
284 fBatch.fColorIgnored = !init.readsColor(); | 285 fBatch.fColorIgnored = init.fColorIgnored; |
285 fBatch.fColor = fGeoData[0].fColor; | 286 fBatch.fColor = fGeoData[0].fColor; |
286 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 287 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; |
287 fBatch.fCoverageIgnored = !init.readsCoverage(); | 288 fBatch.fCoverageIgnored = init.fCoverageIgnored; |
288 } | 289 } |
289 | 290 |
290 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 291 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
291 SkAutoTUnref<const GrGeometryProcessor> gp( | 292 SkAutoTUnref<const GrGeometryProcessor> gp( |
292 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, | 293 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, |
293 this->color(), | 294 this->color(), |
294 this->usesLocalCoords(), | 295 this->usesLocalCoords(), |
295 this->coverageIgnored(), | 296 this->coverageIgnored(), |
296 this->viewMatrix(), | 297 this->viewMatrix(), |
297 SkMatrix::I())); | 298 SkMatrix::I())); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 out->setKnownFourComponents(fGeoData[0].fColor); | 607 out->setKnownFourComponents(fGeoData[0].fColor); |
607 } | 608 } |
608 } | 609 } |
609 | 610 |
610 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 611 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
611 out->setKnownSingleComponent(0xff); | 612 out->setKnownSingleComponent(0xff); |
612 } | 613 } |
613 | 614 |
614 void initBatchTracker(const GrPipelineInfo& init) override { | 615 void initBatchTracker(const GrPipelineInfo& init) override { |
615 // Handle any color overrides | 616 // Handle any color overrides |
616 if (!init.readsColor()) { | 617 if (init.fColorIgnored) { |
617 fGeoData[0].fColor = GrColor_ILLEGAL; | 618 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 619 } else if (GrColor_ILLEGAL != init.fOverrideColor) { |
| 620 fGeoData[0].fColor = init.fOverrideColor; |
618 } | 621 } |
619 init.getOverrideColorIfSet(&fGeoData[0].fColor); | |
620 | 622 |
621 // setup batch properties | 623 // setup batch properties |
622 fBatch.fColorIgnored = !init.readsColor(); | 624 fBatch.fColorIgnored = init.fColorIgnored; |
623 fBatch.fColor = fGeoData[0].fColor; | 625 fBatch.fColor = fGeoData[0].fColor; |
624 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 626 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; |
625 fBatch.fCoverageIgnored = !init.readsCoverage(); | 627 fBatch.fCoverageIgnored = init.fCoverageIgnored; |
626 } | 628 } |
627 | 629 |
628 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 630 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
629 int colorOffset = -1, texOffset = -1; | 631 int colorOffset = -1, texOffset = -1; |
630 SkAutoTUnref<const GrGeometryProcessor> gp( | 632 SkAutoTUnref<const GrGeometryProcessor> gp( |
631 set_vertex_attributes(this->hasLocalCoords(), this->hasColors(),
&colorOffset, | 633 set_vertex_attributes(this->hasLocalCoords(), this->hasColors(),
&colorOffset, |
632 &texOffset, this->color(), this->viewMatri
x(), | 634 &texOffset, this->color(), this->viewMatri
x(), |
633 this->coverageIgnored())); | 635 this->coverageIgnored())); |
634 | 636 |
635 batchTarget->initDraw(gp, pipeline); | 637 batchTarget->initDraw(gp, pipeline); |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 return DrawVerticesBatch::Create(geometry, type, viewMatrix, | 1328 return DrawVerticesBatch::Create(geometry, type, viewMatrix, |
1327 positions.begin(), vertexCount, | 1329 positions.begin(), vertexCount, |
1328 indices.begin(), hasIndices ? vertexCount :
0, | 1330 indices.begin(), hasIndices ? vertexCount :
0, |
1329 colors.begin(), | 1331 colors.begin(), |
1330 texCoords.begin(), | 1332 texCoords.begin(), |
1331 bounds); | 1333 bounds); |
1332 } | 1334 } |
1333 | 1335 |
1334 #endif | 1336 #endif |
1335 | 1337 |
OLD | NEW |