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