| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
| 9 | 9 |
| 10 #include "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 | 642 |
| 643 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 643 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 644 // When this is called on a batch, there is only one geometry bundle | 644 // When this is called on a batch, there is only one geometry bundle |
| 645 out->setKnownFourComponents(fGeoData[0].fColor); | 645 out->setKnownFourComponents(fGeoData[0].fColor); |
| 646 } | 646 } |
| 647 | 647 |
| 648 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 648 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 649 out->setUnknownSingleComponent(); | 649 out->setUnknownSingleComponent(); |
| 650 } | 650 } |
| 651 | 651 |
| 652 void initBatchTracker(const GrPipelineInfo& init) override { | 652 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 653 // Handle any color overrides | 653 // Handle any color overrides |
| 654 if (!init.readsColor()) { | 654 if (!opt.readsColor()) { |
| 655 fGeoData[0].fColor = GrColor_ILLEGAL; | 655 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 656 } | 656 } |
| 657 init.getOverrideColorIfSet(&fGeoData[0].fColor); | 657 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 658 | 658 |
| 659 // setup batch properties | 659 // setup batch properties |
| 660 fBatch.fColorIgnored = !init.readsColor(); | 660 fBatch.fColorIgnored = !opt.readsColor(); |
| 661 fBatch.fColor = fGeoData[0].fColor; | 661 fBatch.fColor = fGeoData[0].fColor; |
| 662 fBatch.fStroke = fGeoData[0].fStroke; | 662 fBatch.fStroke = fGeoData[0].fStroke; |
| 663 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 663 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); |
| 664 fBatch.fCoverageIgnored = !init.readsCoverage(); | 664 fBatch.fCoverageIgnored = !opt.readsCoverage(); |
| 665 } | 665 } |
| 666 | 666 |
| 667 void generateGeometry(GrBatchTarget* batchTarget) override { | 667 void generateGeometry(GrBatchTarget* batchTarget) override { |
| 668 SkMatrix invert; | 668 SkMatrix invert; |
| 669 if (!this->viewMatrix().invert(&invert)) { | 669 if (!this->viewMatrix().invert(&invert)) { |
| 670 return; | 670 return; |
| 671 } | 671 } |
| 672 | 672 |
| 673 // Setup geometry processor | 673 // Setup geometry processor |
| 674 SkAutoTUnref<GrGeometryProcessor> gp(CircleEdgeEffect::Create(this->colo
r(), | 674 SkAutoTUnref<GrGeometryProcessor> gp(CircleEdgeEffect::Create(this->colo
r(), |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 const char* name() const override { return "EllipseBatch"; } | 860 const char* name() const override { return "EllipseBatch"; } |
| 861 | 861 |
| 862 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 862 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 863 // When this is called on a batch, there is only one geometry bundle | 863 // When this is called on a batch, there is only one geometry bundle |
| 864 out->setKnownFourComponents(fGeoData[0].fColor); | 864 out->setKnownFourComponents(fGeoData[0].fColor); |
| 865 } | 865 } |
| 866 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 866 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 867 out->setUnknownSingleComponent(); | 867 out->setUnknownSingleComponent(); |
| 868 } | 868 } |
| 869 | 869 |
| 870 void initBatchTracker(const GrPipelineInfo& init) override { | 870 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 871 // Handle any color overrides | 871 // Handle any color overrides |
| 872 if (!init.readsCoverage()) { | 872 if (!opt.readsCoverage()) { |
| 873 fGeoData[0].fColor = GrColor_ILLEGAL; | 873 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 874 } | 874 } |
| 875 init.getOverrideColorIfSet(&fGeoData[0].fColor); | 875 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 876 | 876 |
| 877 // setup batch properties | 877 // setup batch properties |
| 878 fBatch.fColorIgnored = !init.readsColor(); | 878 fBatch.fColorIgnored = !opt.readsColor(); |
| 879 fBatch.fColor = fGeoData[0].fColor; | 879 fBatch.fColor = fGeoData[0].fColor; |
| 880 fBatch.fStroke = fGeoData[0].fStroke; | 880 fBatch.fStroke = fGeoData[0].fStroke; |
| 881 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 881 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); |
| 882 fBatch.fCoverageIgnored = !init.readsCoverage(); | 882 fBatch.fCoverageIgnored = !opt.readsCoverage(); |
| 883 } | 883 } |
| 884 | 884 |
| 885 void generateGeometry(GrBatchTarget* batchTarget) override { | 885 void generateGeometry(GrBatchTarget* batchTarget) override { |
| 886 SkMatrix invert; | 886 SkMatrix invert; |
| 887 if (!this->viewMatrix().invert(&invert)) { | 887 if (!this->viewMatrix().invert(&invert)) { |
| 888 return; | 888 return; |
| 889 } | 889 } |
| 890 | 890 |
| 891 // Setup geometry processor | 891 // Setup geometry processor |
| 892 SkAutoTUnref<GrGeometryProcessor> gp(EllipseEdgeEffect::Create(this->col
or(), | 892 SkAutoTUnref<GrGeometryProcessor> gp(EllipseEdgeEffect::Create(this->col
or(), |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 const char* name() const override { return "DIEllipseBatch"; } | 1127 const char* name() const override { return "DIEllipseBatch"; } |
| 1128 | 1128 |
| 1129 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 1129 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 1130 // When this is called on a batch, there is only one geometry bundle | 1130 // When this is called on a batch, there is only one geometry bundle |
| 1131 out->setKnownFourComponents(fGeoData[0].fColor); | 1131 out->setKnownFourComponents(fGeoData[0].fColor); |
| 1132 } | 1132 } |
| 1133 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 1133 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 1134 out->setUnknownSingleComponent(); | 1134 out->setUnknownSingleComponent(); |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 void initBatchTracker(const GrPipelineInfo& init) override { | 1137 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 1138 // Handle any color overrides | 1138 // Handle any color overrides |
| 1139 if (!init.readsColor()) { | 1139 if (!opt.readsColor()) { |
| 1140 fGeoData[0].fColor = GrColor_ILLEGAL; | 1140 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 1141 } | 1141 } |
| 1142 init.getOverrideColorIfSet(&fGeoData[0].fColor); | 1142 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 1143 | 1143 |
| 1144 // setup batch properties | 1144 // setup batch properties |
| 1145 fBatch.fColorIgnored = !init.readsColor(); | 1145 fBatch.fColorIgnored = !opt.readsColor(); |
| 1146 fBatch.fColor = fGeoData[0].fColor; | 1146 fBatch.fColor = fGeoData[0].fColor; |
| 1147 fBatch.fMode = fGeoData[0].fMode; | 1147 fBatch.fMode = fGeoData[0].fMode; |
| 1148 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 1148 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); |
| 1149 fBatch.fCoverageIgnored = !init.readsCoverage(); | 1149 fBatch.fCoverageIgnored = !opt.readsCoverage(); |
| 1150 } | 1150 } |
| 1151 | 1151 |
| 1152 void generateGeometry(GrBatchTarget* batchTarget) override { | 1152 void generateGeometry(GrBatchTarget* batchTarget) override { |
| 1153 // Setup geometry processor | 1153 // Setup geometry processor |
| 1154 SkAutoTUnref<GrGeometryProcessor> gp(DIEllipseEdgeEffect::Create(this->c
olor(), | 1154 SkAutoTUnref<GrGeometryProcessor> gp(DIEllipseEdgeEffect::Create(this->c
olor(), |
| 1155 this->v
iewMatrix(), | 1155 this->v
iewMatrix(), |
| 1156 this->m
ode(), | 1156 this->m
ode(), |
| 1157 this->u
sesLocalCoords())); | 1157 this->u
sesLocalCoords())); |
| 1158 | 1158 |
| 1159 batchTarget->initDraw(gp, this->pipeline()); | 1159 batchTarget->initDraw(gp, this->pipeline()); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 const char* name() const override { return "RRectCircleBatch"; } | 1478 const char* name() const override { return "RRectCircleBatch"; } |
| 1479 | 1479 |
| 1480 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 1480 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 1481 // When this is called on a batch, there is only one geometry bundle | 1481 // When this is called on a batch, there is only one geometry bundle |
| 1482 out->setKnownFourComponents(fGeoData[0].fColor); | 1482 out->setKnownFourComponents(fGeoData[0].fColor); |
| 1483 } | 1483 } |
| 1484 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 1484 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 1485 out->setUnknownSingleComponent(); | 1485 out->setUnknownSingleComponent(); |
| 1486 } | 1486 } |
| 1487 | 1487 |
| 1488 void initBatchTracker(const GrPipelineInfo& init) override { | 1488 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 1489 // Handle any color overrides | 1489 // Handle any color overrides |
| 1490 if (!init.readsColor()) { | 1490 if (!opt.readsColor()) { |
| 1491 fGeoData[0].fColor = GrColor_ILLEGAL; | 1491 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 1492 } | 1492 } |
| 1493 init.getOverrideColorIfSet(&fGeoData[0].fColor); | 1493 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 1494 | 1494 |
| 1495 // setup batch properties | 1495 // setup batch properties |
| 1496 fBatch.fColorIgnored = !init.readsColor(); | 1496 fBatch.fColorIgnored = !opt.readsColor(); |
| 1497 fBatch.fColor = fGeoData[0].fColor; | 1497 fBatch.fColor = fGeoData[0].fColor; |
| 1498 fBatch.fStroke = fGeoData[0].fStroke; | 1498 fBatch.fStroke = fGeoData[0].fStroke; |
| 1499 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 1499 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); |
| 1500 fBatch.fCoverageIgnored = !init.readsCoverage(); | 1500 fBatch.fCoverageIgnored = !opt.readsCoverage(); |
| 1501 } | 1501 } |
| 1502 | 1502 |
| 1503 void generateGeometry(GrBatchTarget* batchTarget) override { | 1503 void generateGeometry(GrBatchTarget* batchTarget) override { |
| 1504 // reset to device coordinates | 1504 // reset to device coordinates |
| 1505 SkMatrix invert; | 1505 SkMatrix invert; |
| 1506 if (!this->viewMatrix().invert(&invert)) { | 1506 if (!this->viewMatrix().invert(&invert)) { |
| 1507 SkDebugf("Failed to invert\n"); | 1507 SkDebugf("Failed to invert\n"); |
| 1508 return; | 1508 return; |
| 1509 } | 1509 } |
| 1510 | 1510 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 const char* name() const override { return "RRectEllipseRendererBatch"; } | 1654 const char* name() const override { return "RRectEllipseRendererBatch"; } |
| 1655 | 1655 |
| 1656 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { | 1656 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { |
| 1657 // When this is called on a batch, there is only one geometry bundle | 1657 // When this is called on a batch, there is only one geometry bundle |
| 1658 out->setKnownFourComponents(fGeoData[0].fColor); | 1658 out->setKnownFourComponents(fGeoData[0].fColor); |
| 1659 } | 1659 } |
| 1660 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { | 1660 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { |
| 1661 out->setUnknownSingleComponent(); | 1661 out->setUnknownSingleComponent(); |
| 1662 } | 1662 } |
| 1663 | 1663 |
| 1664 void initBatchTracker(const GrPipelineInfo& init) override { | 1664 void initBatchTracker(const GrPipelineOptimizations& opt) override { |
| 1665 // Handle any color overrides | 1665 // Handle any color overrides |
| 1666 if (!init.readsColor()) { | 1666 if (!opt.readsColor()) { |
| 1667 fGeoData[0].fColor = GrColor_ILLEGAL; | 1667 fGeoData[0].fColor = GrColor_ILLEGAL; |
| 1668 } | 1668 } |
| 1669 init.getOverrideColorIfSet(&fGeoData[0].fColor); | 1669 opt.getOverrideColorIfSet(&fGeoData[0].fColor); |
| 1670 | 1670 |
| 1671 // setup batch properties | 1671 // setup batch properties |
| 1672 fBatch.fColorIgnored = !init.readsColor(); | 1672 fBatch.fColorIgnored = !opt.readsColor(); |
| 1673 fBatch.fColor = fGeoData[0].fColor; | 1673 fBatch.fColor = fGeoData[0].fColor; |
| 1674 fBatch.fStroke = fGeoData[0].fStroke; | 1674 fBatch.fStroke = fGeoData[0].fStroke; |
| 1675 fBatch.fUsesLocalCoords = init.readsLocalCoords(); | 1675 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); |
| 1676 fBatch.fCoverageIgnored = !init.readsCoverage(); | 1676 fBatch.fCoverageIgnored = !opt.readsCoverage(); |
| 1677 } | 1677 } |
| 1678 | 1678 |
| 1679 void generateGeometry(GrBatchTarget* batchTarget) override { | 1679 void generateGeometry(GrBatchTarget* batchTarget) override { |
| 1680 // reset to device coordinates | 1680 // reset to device coordinates |
| 1681 SkMatrix invert; | 1681 SkMatrix invert; |
| 1682 if (!this->viewMatrix().invert(&invert)) { | 1682 if (!this->viewMatrix().invert(&invert)) { |
| 1683 SkDebugf("Failed to invert\n"); | 1683 SkDebugf("Failed to invert\n"); |
| 1684 return; | 1684 return; |
| 1685 } | 1685 } |
| 1686 | 1686 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2032 } | 2032 } |
| 2033 | 2033 |
| 2034 BATCH_TEST_DEFINE(RRectBatch) { | 2034 BATCH_TEST_DEFINE(RRectBatch) { |
| 2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 2035 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
| 2036 GrColor color = GrRandomColor(random); | 2036 GrColor color = GrRandomColor(random); |
| 2037 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 2037 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
| 2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 2038 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
| 2039 } | 2039 } |
| 2040 | 2040 |
| 2041 #endif | 2041 #endif |
| OLD | NEW |