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

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

Issue 1264283004: Revert of Use new API everywhere for GrDefaultGeoProcFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@lccleanup2
Patch Set: Created 5 years, 4 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 | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 tess.coverage(i); 711 tess.coverage(i);
712 } 712 }
713 } 713 }
714 714
715 for (int i = 0; i < tess.numIndices(); ++i) { 715 for (int i = 0; i < tess.numIndices(); ++i) {
716 idxs[i] = tess.index(i); 716 idxs[i] = tess.index(i);
717 } 717 }
718 } 718 }
719 719
720 static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage, 720 static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage,
721 const SkMatrix& viewMatrix, 721 const SkMatrix& localMatrix,
722 bool usesLocalCoords, 722 bool usesLocalCoords,
723 bool coverageIgnored) { 723 bool coverageIgnored) {
724 using namespace GrDefaultGeoProcFactory; 724 uint32_t flags = GrDefaultGeoProcFactory::kColor_GPType;
725 if (!tweakAlphaForCoverage) {
726 flags |= GrDefaultGeoProcFactory::kCoverage_GPType;
727 }
725 728
726 Color color(Color::kAttribute_Type); 729 return GrDefaultGeoProcFactory::Create(flags, GrColor_WHITE, usesLocalCoords , coverageIgnored,
727 Coverage::Type coverageType; 730 SkMatrix::I(), localMatrix);
728 if (coverageIgnored) {
729 coverageType = Coverage::kNone_Type;
730 } else if (tweakAlphaForCoverage) {
731 coverageType = Coverage::kSolid_Type;
732 } else {
733 coverageType = Coverage::kAttribute_Type;
734 }
735 Coverage coverage(coverageType);
736 LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type :
737 LocalCoords::kUnused_Type);
738 return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
739 } 731 }
740 732
741 class AAConvexPathBatch : public GrBatch { 733 class AAConvexPathBatch : public GrBatch {
742 public: 734 public:
743 struct Geometry { 735 struct Geometry {
744 GrColor fColor; 736 GrColor fColor;
745 SkMatrix fViewMatrix; 737 SkMatrix fViewMatrix;
746 SkPath fPath; 738 SkPath fPath;
747 }; 739 };
748 740
(...skipping 23 matching lines...) Expand all
772 fBatch.fColor = fGeoData[0].fColor; 764 fBatch.fColor = fGeoData[0].fColor;
773 fBatch.fUsesLocalCoords = init.readsLocalCoords(); 765 fBatch.fUsesLocalCoords = init.readsLocalCoords();
774 fBatch.fCoverageIgnored = !init.readsCoverage(); 766 fBatch.fCoverageIgnored = !init.readsCoverage();
775 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe gmentMasks(); 767 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe gmentMasks();
776 fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); 768 fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
777 } 769 }
778 770
779 void generateGeometryLinesOnly(GrBatchTarget* batchTarget, const GrPipeline* pipeline) { 771 void generateGeometryLinesOnly(GrBatchTarget* batchTarget, const GrPipeline* pipeline) {
780 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); 772 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
781 773
782 // Setup GrGeometryProcessor 774 SkMatrix invert;
783 SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaF orCoverage, 775 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) {
784 this->viewMatr ix(), 776 SkDebugf("Could not invert viewmatrix\n");
785 this->usesLoca lCoords(),
786 this->coverage Ignored()));
787 if (!gp) {
788 SkDebugf("Could not create GrGeometryProcessor\n");
789 return; 777 return;
790 } 778 }
791 779
780 // Setup GrGeometryProcessor
781 SkAutoTUnref<const GrGeometryProcessor> gp(
782 create_fill_gp(canTweakAlphaForC overage, invert,
783 this->usesLocalCo ords(),
784 this->coverageIgn ored()));
785
792 batchTarget->initDraw(gp, pipeline); 786 batchTarget->initDraw(gp, pipeline);
793 787
794 size_t vertexStride = gp->getVertexStride(); 788 size_t vertexStride = gp->getVertexStride();
795 789
796 SkASSERT(canTweakAlphaForCoverage ? 790 SkASSERT(canTweakAlphaForCoverage ?
797 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt tr) : 791 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt tr) :
798 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCo verageAttr)); 792 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCo verageAttr));
799 793
800 GrAAConvexTessellator tess; 794 GrAAConvexTessellator tess;
801 795
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 BATCH_TEST_DEFINE(AAConvexPathBatch) { 1008 BATCH_TEST_DEFINE(AAConvexPathBatch) {
1015 AAConvexPathBatch::Geometry geometry; 1009 AAConvexPathBatch::Geometry geometry;
1016 geometry.fColor = GrRandomColor(random); 1010 geometry.fColor = GrRandomColor(random);
1017 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1011 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1018 geometry.fPath = GrTest::TestPathConvex(random); 1012 geometry.fPath = GrTest::TestPathConvex(random);
1019 1013
1020 return AAConvexPathBatch::Create(geometry); 1014 return AAConvexPathBatch::Create(geometry);
1021 } 1015 }
1022 1016
1023 #endif 1017 #endif
OLDNEW
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698