| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrAARectRenderer.h" | 8 #include "GrAARectRenderer.h" |
| 9 #include "GrBatch.h" | 9 #include "GrBatch.h" |
| 10 #include "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // When this is called on a batch, there is only one geometry bundle | 69 // When this is called on a batch, there is only one geometry bundle |
| 70 out->setKnownFourComponents(fGeoData[0].fColor); | 70 out->setKnownFourComponents(fGeoData[0].fColor); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 73 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 74 out->setUnknownSingleComponent(); | 74 out->setUnknownSingleComponent(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void initBatchTracker(const GrPipelineInfo& init) override { | 77 void initBatchTracker(const GrPipelineInfo& init) override { |
| 78 // Handle any color overrides | 78 // Handle any color overrides |
| 79 if (init.fColorIgnored) { | 79 if (!init.readsColor()) { |
| 80 fGeoData[0].fColor = GrColor_ILLEGAL; | 80 fBatch.fColor = GrColor_ILLEGAL; |
| 81 } else if (GrColor_ILLEGAL != init.fOverrideColor) { | |
| 82 fGeoData[0].fColor = init.fOverrideColor; | |
| 83 } | 81 } |
| 82 init.getOverrideColorIfSet(&fBatch.fColor); |
| 84 | 83 |
| 85 // setup batch properties | 84 // setup batch properties |
| 86 fBatch.fColorIgnored = init.fColorIgnored; | 85 fBatch.fColorIgnored = !init.readsColor(); |
| 87 fBatch.fColor = fGeoData[0].fColor; | 86 fBatch.fUsesLocalCoords = init.readsLocalCoords(); |
| 88 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; | 87 fBatch.fCoverageIgnored = !init.readsCoverage(); |
| 89 fBatch.fCoverageIgnored = init.fCoverageIgnored; | 88 fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); |
| 90 fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage; | |
| 91 } | 89 } |
| 92 | 90 |
| 93 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 91 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
| 94 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); | 92 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
| 95 | 93 |
| 96 SkMatrix localMatrix; | 94 SkMatrix localMatrix; |
| 97 if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix))
{ | 95 if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix))
{ |
| 98 SkDebugf("Cannot invert\n"); | 96 SkDebugf("Cannot invert\n"); |
| 99 return; | 97 return; |
| 100 } | 98 } |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 // When this is called on a batch, there is only one geometry bundle | 415 // When this is called on a batch, there is only one geometry bundle |
| 418 out->setKnownFourComponents(fGeoData[0].fColor); | 416 out->setKnownFourComponents(fGeoData[0].fColor); |
| 419 } | 417 } |
| 420 | 418 |
| 421 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 419 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 422 out->setUnknownSingleComponent(); | 420 out->setUnknownSingleComponent(); |
| 423 } | 421 } |
| 424 | 422 |
| 425 void initBatchTracker(const GrPipelineInfo& init) override { | 423 void initBatchTracker(const GrPipelineInfo& init) override { |
| 426 // Handle any color overrides | 424 // Handle any color overrides |
| 427 if (init.fColorIgnored) { | 425 if (!init.readsColor()) { |
| 428 fGeoData[0].fColor = GrColor_ILLEGAL; | 426 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 429 } else if (GrColor_ILLEGAL != init.fOverrideColor) { | |
| 430 fGeoData[0].fColor = init.fOverrideColor; | |
| 431 } | 427 } |
| 428 init.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 432 | 429 |
| 433 // setup batch properties | 430 // setup batch properties |
| 434 fBatch.fColorIgnored = init.fColorIgnored; | 431 fBatch.fColorIgnored = !init.readsColor(); |
| 435 fBatch.fColor = fGeoData[0].fColor; | 432 fBatch.fColor = fGeoData[0].fColor; |
| 436 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; | 433 fBatch.fUsesLocalCoords = init.readsLocalCoords(); |
| 437 fBatch.fCoverageIgnored = init.fCoverageIgnored; | 434 fBatch.fCoverageIgnored = !init.readsCoverage(); |
| 438 fBatch.fMiterStroke = fGeoData[0].fMiterStroke; | 435 fBatch.fMiterStroke = fGeoData[0].fMiterStroke; |
| 439 fBatch.fCanTweakAlphaForCoverage = init.fCanTweakAlphaForCoverage; | 436 fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); |
| 440 } | 437 } |
| 441 | 438 |
| 442 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { | 439 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline
) override { |
| 443 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); | 440 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
| 444 | 441 |
| 445 // Local matrix is ignored if we don't have local coords. If we have lo
calcoords we only | 442 // Local matrix is ignored if we don't have local coords. If we have lo
calcoords we only |
| 446 // batch with identical view matrices | 443 // batch with identical view matrices |
| 447 SkMatrix localMatrix; | 444 SkMatrix localMatrix; |
| 448 if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix))
{ | 445 if (this->usesLocalCoords() && !this->viewMatrix().invert(&localMatrix))
{ |
| 449 SkDebugf("Cannot invert\n"); | 446 SkDebugf("Cannot invert\n"); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 geo.fColor = GrRandomColor(random); | 840 geo.fColor = GrRandomColor(random); |
| 844 geo.fDevOutside = outside; | 841 geo.fDevOutside = outside; |
| 845 geo.fDevOutsideAssist = outsideAssist; | 842 geo.fDevOutsideAssist = outsideAssist; |
| 846 geo.fDevInside = inside; | 843 geo.fDevInside = inside; |
| 847 geo.fMiterStroke = miterStroke; | 844 geo.fMiterStroke = miterStroke; |
| 848 | 845 |
| 849 return AAStrokeRectBatch::Create(geo, GrTest::TestMatrix(random)); | 846 return AAStrokeRectBatch::Create(geo, GrTest::TestMatrix(random)); |
| 850 } | 847 } |
| 851 | 848 |
| 852 #endif | 849 #endif |
| OLD | NEW |