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.fColorIgnored) { | 278 if (!init.readsColor()) { |
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; | |
282 } | 280 } |
| 281 init.getOverrideColorIfSet(&fGeoData[0].fColor); |
283 | 282 |
284 // setup batch properties | 283 // setup batch properties |
285 fBatch.fColorIgnored = init.fColorIgnored; | 284 fBatch.fColorIgnored = !init.readsColor(); |
286 fBatch.fColor = fGeoData[0].fColor; | 285 fBatch.fColor = fGeoData[0].fColor; |
287 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; | 286 fBatch.fUsesLocalCoords = init.readsLocalCoords(); |
288 fBatch.fCoverageIgnored = init.fCoverageIgnored; | 287 fBatch.fCoverageIgnored = !init.readsCoverage(); |
289 } | 288 } |
290 | 289 |
291 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 290 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
292 SkAutoTUnref<const GrGeometryProcessor> gp( | 291 SkAutoTUnref<const GrGeometryProcessor> gp( |
293 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, | 292 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi
on_GPType, |
294 this->color(), | 293 this->color(), |
295 this->usesLocalCoords(), | 294 this->usesLocalCoords(), |
296 this->coverageIgnored(), | 295 this->coverageIgnored(), |
297 this->viewMatrix(), | 296 this->viewMatrix(), |
298 SkMatrix::I())); | 297 SkMatrix::I())); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 out->setKnownFourComponents(fGeoData[0].fColor); | 606 out->setKnownFourComponents(fGeoData[0].fColor); |
608 } | 607 } |
609 } | 608 } |
610 | 609 |
611 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 610 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
612 out->setKnownSingleComponent(0xff); | 611 out->setKnownSingleComponent(0xff); |
613 } | 612 } |
614 | 613 |
615 void initBatchTracker(const GrPipelineInfo& init) override { | 614 void initBatchTracker(const GrPipelineInfo& init) override { |
616 // Handle any color overrides | 615 // Handle any color overrides |
617 if (init.fColorIgnored) { | 616 if (!init.readsColor()) { |
618 fGeoData[0].fColor = GrColor_ILLEGAL; | 617 fGeoData[0].fColor = GrColor_ILLEGAL; |
619 } else if (GrColor_ILLEGAL != init.fOverrideColor) { | |
620 fGeoData[0].fColor = init.fOverrideColor; | |
621 } | 618 } |
| 619 init.getOverrideColorIfSet(&fGeoData[0].fColor); |
622 | 620 |
623 // setup batch properties | 621 // setup batch properties |
624 fBatch.fColorIgnored = init.fColorIgnored; | 622 fBatch.fColorIgnored = !init.readsColor(); |
625 fBatch.fColor = fGeoData[0].fColor; | 623 fBatch.fColor = fGeoData[0].fColor; |
626 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; | 624 fBatch.fUsesLocalCoords = init.readsLocalCoords(); |
627 fBatch.fCoverageIgnored = init.fCoverageIgnored; | 625 fBatch.fCoverageIgnored = !init.readsCoverage(); |
628 } | 626 } |
629 | 627 |
630 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 628 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
631 int colorOffset = -1, texOffset = -1; | 629 int colorOffset = -1, texOffset = -1; |
632 SkAutoTUnref<const GrGeometryProcessor> gp( | 630 SkAutoTUnref<const GrGeometryProcessor> gp( |
633 set_vertex_attributes(this->hasLocalCoords(), this->hasColors(),
&colorOffset, | 631 set_vertex_attributes(this->hasLocalCoords(), this->hasColors(),
&colorOffset, |
634 &texOffset, this->color(), this->viewMatri
x(), | 632 &texOffset, this->color(), this->viewMatri
x(), |
635 this->coverageIgnored())); | 633 this->coverageIgnored())); |
636 | 634 |
637 batchTarget->initDraw(gp, pipeline); | 635 batchTarget->initDraw(gp, pipeline); |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 return DrawVerticesBatch::Create(geometry, type, viewMatrix, | 1326 return DrawVerticesBatch::Create(geometry, type, viewMatrix, |
1329 positions.begin(), vertexCount, | 1327 positions.begin(), vertexCount, |
1330 indices.begin(), hasIndices ? vertexCount :
0, | 1328 indices.begin(), hasIndices ? vertexCount :
0, |
1331 colors.begin(), | 1329 colors.begin(), |
1332 texCoords.begin(), | 1330 texCoords.begin(), |
1333 bounds); | 1331 bounds); |
1334 } | 1332 } |
1335 | 1333 |
1336 #endif | 1334 #endif |
1337 | 1335 |
OLD | NEW |