Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: src/gpu/GrOvalRenderer.cpp

Issue 1213383005: Rework GrPipelineInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixed Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrPathProcessor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 // When this is called on a batch, there is only one geometry bundle 654 // When this is called on a batch, there is only one geometry bundle
655 out->setKnownFourComponents(fGeoData[0].fColor); 655 out->setKnownFourComponents(fGeoData[0].fColor);
656 } 656 }
657 657
658 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { 658 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
659 out->setUnknownSingleComponent(); 659 out->setUnknownSingleComponent();
660 } 660 }
661 661
662 void initBatchTracker(const GrPipelineInfo& init) override { 662 void initBatchTracker(const GrPipelineInfo& init) override {
663 // Handle any color overrides 663 // Handle any color overrides
664 if (init.fColorIgnored) { 664 if (!init.readsColor()) {
665 fGeoData[0].fColor = GrColor_ILLEGAL; 665 fGeoData[0].fColor = GrColor_ILLEGAL;
666 } else if (GrColor_ILLEGAL != init.fOverrideColor) {
667 fGeoData[0].fColor = init.fOverrideColor;
668 } 666 }
667 init.getOverrideColorIfSet(&fGeoData[0].fColor);
669 668
670 // setup batch properties 669 // setup batch properties
671 fBatch.fColorIgnored = init.fColorIgnored; 670 fBatch.fColorIgnored = !init.readsColor();
672 fBatch.fColor = fGeoData[0].fColor; 671 fBatch.fColor = fGeoData[0].fColor;
673 fBatch.fStroke = fGeoData[0].fStroke; 672 fBatch.fStroke = fGeoData[0].fStroke;
674 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; 673 fBatch.fUsesLocalCoords = init.readsLocalCoords();
675 fBatch.fCoverageIgnored = init.fCoverageIgnored; 674 fBatch.fCoverageIgnored = !init.readsCoverage();
676 } 675 }
677 676
678 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 677 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
679 SkMatrix invert; 678 SkMatrix invert;
680 if (!this->viewMatrix().invert(&invert)) { 679 if (!this->viewMatrix().invert(&invert)) {
681 return; 680 return;
682 } 681 }
683 682
684 // Setup geometry processor 683 // Setup geometry processor
685 SkAutoTUnref<GrGeometryProcessor> gp(CircleEdgeEffect::Create(this->colo r(), 684 SkAutoTUnref<GrGeometryProcessor> gp(CircleEdgeEffect::Create(this->colo r(),
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { 868 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
870 // When this is called on a batch, there is only one geometry bundle 869 // When this is called on a batch, there is only one geometry bundle
871 out->setKnownFourComponents(fGeoData[0].fColor); 870 out->setKnownFourComponents(fGeoData[0].fColor);
872 } 871 }
873 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { 872 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
874 out->setUnknownSingleComponent(); 873 out->setUnknownSingleComponent();
875 } 874 }
876 875
877 void initBatchTracker(const GrPipelineInfo& init) override { 876 void initBatchTracker(const GrPipelineInfo& init) override {
878 // Handle any color overrides 877 // Handle any color overrides
879 if (init.fColorIgnored) { 878 if (!init.readsCoverage()) {
880 fGeoData[0].fColor = GrColor_ILLEGAL; 879 fGeoData[0].fColor = GrColor_ILLEGAL;
881 } else if (GrColor_ILLEGAL != init.fOverrideColor) {
882 fGeoData[0].fColor = init.fOverrideColor;
883 } 880 }
881 init.getOverrideColorIfSet(&fGeoData[0].fColor);
884 882
885 // setup batch properties 883 // setup batch properties
886 fBatch.fColorIgnored = init.fColorIgnored; 884 fBatch.fColorIgnored = !init.readsColor();
887 fBatch.fColor = fGeoData[0].fColor; 885 fBatch.fColor = fGeoData[0].fColor;
888 fBatch.fStroke = fGeoData[0].fStroke; 886 fBatch.fStroke = fGeoData[0].fStroke;
889 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; 887 fBatch.fUsesLocalCoords = init.readsLocalCoords();
890 fBatch.fCoverageIgnored = init.fCoverageIgnored; 888 fBatch.fCoverageIgnored = !init.readsCoverage();
891 } 889 }
892 890
893 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 891 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
894 SkMatrix invert; 892 SkMatrix invert;
895 if (!this->viewMatrix().invert(&invert)) { 893 if (!this->viewMatrix().invert(&invert)) {
896 return; 894 return;
897 } 895 }
898 896
899 // Setup geometry processor 897 // Setup geometry processor
900 SkAutoTUnref<GrGeometryProcessor> gp(EllipseEdgeEffect::Create(this->col or(), 898 SkAutoTUnref<GrGeometryProcessor> gp(EllipseEdgeEffect::Create(this->col or(),
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { 1131 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
1134 // When this is called on a batch, there is only one geometry bundle 1132 // When this is called on a batch, there is only one geometry bundle
1135 out->setKnownFourComponents(fGeoData[0].fColor); 1133 out->setKnownFourComponents(fGeoData[0].fColor);
1136 } 1134 }
1137 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { 1135 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
1138 out->setUnknownSingleComponent(); 1136 out->setUnknownSingleComponent();
1139 } 1137 }
1140 1138
1141 void initBatchTracker(const GrPipelineInfo& init) override { 1139 void initBatchTracker(const GrPipelineInfo& init) override {
1142 // Handle any color overrides 1140 // Handle any color overrides
1143 if (init.fColorIgnored) { 1141 if (!init.readsColor()) {
1144 fGeoData[0].fColor = GrColor_ILLEGAL; 1142 fGeoData[0].fColor = GrColor_ILLEGAL;
1145 } else if (GrColor_ILLEGAL != init.fOverrideColor) {
1146 fGeoData[0].fColor = init.fOverrideColor;
1147 } 1143 }
1144 init.getOverrideColorIfSet(&fGeoData[0].fColor);
1148 1145
1149 // setup batch properties 1146 // setup batch properties
1150 fBatch.fColorIgnored = init.fColorIgnored; 1147 fBatch.fColorIgnored = !init.readsColor();
1151 fBatch.fColor = fGeoData[0].fColor; 1148 fBatch.fColor = fGeoData[0].fColor;
1152 fBatch.fMode = fGeoData[0].fMode; 1149 fBatch.fMode = fGeoData[0].fMode;
1153 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; 1150 fBatch.fUsesLocalCoords = init.readsLocalCoords();
1154 fBatch.fCoverageIgnored = init.fCoverageIgnored; 1151 fBatch.fCoverageIgnored = !init.readsCoverage();
1155 } 1152 }
1156 1153
1157 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 1154 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
1158 // Setup geometry processor 1155 // Setup geometry processor
1159 SkAutoTUnref<GrGeometryProcessor> gp(DIEllipseEdgeEffect::Create(this->c olor(), 1156 SkAutoTUnref<GrGeometryProcessor> gp(DIEllipseEdgeEffect::Create(this->c olor(),
1160 this->v iewMatrix(), 1157 this->v iewMatrix(),
1161 this->m ode(), 1158 this->m ode(),
1162 this->u sesLocalCoords())); 1159 this->u sesLocalCoords()));
1163 1160
1164 batchTarget->initDraw(gp, pipeline); 1161 batchTarget->initDraw(gp, pipeline);
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { 1479 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
1483 // When this is called on a batch, there is only one geometry bundle 1480 // When this is called on a batch, there is only one geometry bundle
1484 out->setKnownFourComponents(fGeoData[0].fColor); 1481 out->setKnownFourComponents(fGeoData[0].fColor);
1485 } 1482 }
1486 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { 1483 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
1487 out->setUnknownSingleComponent(); 1484 out->setUnknownSingleComponent();
1488 } 1485 }
1489 1486
1490 void initBatchTracker(const GrPipelineInfo& init) override { 1487 void initBatchTracker(const GrPipelineInfo& init) override {
1491 // Handle any color overrides 1488 // Handle any color overrides
1492 if (init.fColorIgnored) { 1489 if (!init.readsColor()) {
1493 fGeoData[0].fColor = GrColor_ILLEGAL; 1490 fGeoData[0].fColor = GrColor_ILLEGAL;
1494 } else if (GrColor_ILLEGAL != init.fOverrideColor) {
1495 fGeoData[0].fColor = init.fOverrideColor;
1496 } 1491 }
1492 init.getOverrideColorIfSet(&fGeoData[0].fColor);
1497 1493
1498 // setup batch properties 1494 // setup batch properties
1499 fBatch.fColorIgnored = init.fColorIgnored; 1495 fBatch.fColorIgnored = !init.readsColor();
1500 fBatch.fColor = fGeoData[0].fColor; 1496 fBatch.fColor = fGeoData[0].fColor;
1501 fBatch.fStroke = fGeoData[0].fStroke; 1497 fBatch.fStroke = fGeoData[0].fStroke;
1502 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; 1498 fBatch.fUsesLocalCoords = init.readsLocalCoords();
1503 fBatch.fCoverageIgnored = init.fCoverageIgnored; 1499 fBatch.fCoverageIgnored = !init.readsCoverage();
1504 } 1500 }
1505 1501
1506 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 1502 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
1507 // reset to device coordinates 1503 // reset to device coordinates
1508 SkMatrix invert; 1504 SkMatrix invert;
1509 if (!this->viewMatrix().invert(&invert)) { 1505 if (!this->viewMatrix().invert(&invert)) {
1510 SkDebugf("Failed to invert\n"); 1506 SkDebugf("Failed to invert\n");
1511 return; 1507 return;
1512 } 1508 }
1513 1509
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 void getInvariantOutputColor(GrInitInvariantOutput* out) const override { 1651 void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
1656 // When this is called on a batch, there is only one geometry bundle 1652 // When this is called on a batch, there is only one geometry bundle
1657 out->setKnownFourComponents(fGeoData[0].fColor); 1653 out->setKnownFourComponents(fGeoData[0].fColor);
1658 } 1654 }
1659 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override { 1655 void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
1660 out->setUnknownSingleComponent(); 1656 out->setUnknownSingleComponent();
1661 } 1657 }
1662 1658
1663 void initBatchTracker(const GrPipelineInfo& init) override { 1659 void initBatchTracker(const GrPipelineInfo& init) override {
1664 // Handle any color overrides 1660 // Handle any color overrides
1665 if (init.fColorIgnored) { 1661 if (!init.readsColor()) {
1666 fGeoData[0].fColor = GrColor_ILLEGAL; 1662 fGeoData[0].fColor = GrColor_ILLEGAL;
1667 } else if (GrColor_ILLEGAL != init.fOverrideColor) {
1668 fGeoData[0].fColor = init.fOverrideColor;
1669 } 1663 }
1664 init.getOverrideColorIfSet(&fGeoData[0].fColor);
1670 1665
1671 // setup batch properties 1666 // setup batch properties
1672 fBatch.fColorIgnored = init.fColorIgnored; 1667 fBatch.fColorIgnored = !init.readsColor();
1673 fBatch.fColor = fGeoData[0].fColor; 1668 fBatch.fColor = fGeoData[0].fColor;
1674 fBatch.fStroke = fGeoData[0].fStroke; 1669 fBatch.fStroke = fGeoData[0].fStroke;
1675 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; 1670 fBatch.fUsesLocalCoords = init.readsLocalCoords();
1676 fBatch.fCoverageIgnored = init.fCoverageIgnored; 1671 fBatch.fCoverageIgnored = !init.readsCoverage();
1677 } 1672 }
1678 1673
1679 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 1674 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
1680 // reset to device coordinates 1675 // reset to device coordinates
1681 SkMatrix invert; 1676 SkMatrix invert;
1682 if (!this->viewMatrix().invert(&invert)) { 1677 if (!this->viewMatrix().invert(&invert)) {
1683 SkDebugf("Failed to invert\n"); 1678 SkDebugf("Failed to invert\n");
1684 return; 1679 return;
1685 } 1680 }
1686 1681
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 } 2023 }
2029 2024
2030 BATCH_TEST_DEFINE(RRectBatch) { 2025 BATCH_TEST_DEFINE(RRectBatch) {
2031 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); 2026 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
2032 GrColor color = GrRandomColor(random); 2027 GrColor color = GrRandomColor(random);
2033 const SkRRect& rrect = GrTest::TestRRectSimple(random); 2028 const SkRRect& rrect = GrTest::TestRRectSimple(random);
2034 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom)); 2029 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra ndom));
2035 } 2030 }
2036 2031
2037 #endif 2032 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.cpp ('k') | src/gpu/GrPathProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698