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

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

Issue 1275083002: Don't pass pipeline to GrBatch::generateGeometry() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
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/GrAADistanceFieldPathRenderer.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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 770
771 // setup batch properties 771 // setup batch properties
772 fBatch.fColorIgnored = !init.readsColor(); 772 fBatch.fColorIgnored = !init.readsColor();
773 fBatch.fColor = fGeoData[0].fColor; 773 fBatch.fColor = fGeoData[0].fColor;
774 fBatch.fUsesLocalCoords = init.readsLocalCoords(); 774 fBatch.fUsesLocalCoords = init.readsLocalCoords();
775 fBatch.fCoverageIgnored = !init.readsCoverage(); 775 fBatch.fCoverageIgnored = !init.readsCoverage();
776 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe gmentMasks(); 776 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe gmentMasks();
777 fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage(); 777 fBatch.fCanTweakAlphaForCoverage = init.canTweakAlphaForCoverage();
778 } 778 }
779 779
780 void generateGeometryLinesOnly(GrBatchTarget* batchTarget, const GrPipeline* pipeline) { 780 void generateGeometryLinesOnly(GrBatchTarget* batchTarget) {
781 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); 781 bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
782 782
783 // Setup GrGeometryProcessor 783 // Setup GrGeometryProcessor
784 SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaF orCoverage, 784 SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaF orCoverage,
785 this->viewMatr ix(), 785 this->viewMatr ix(),
786 this->usesLoca lCoords(), 786 this->usesLoca lCoords(),
787 this->coverage Ignored())); 787 this->coverage Ignored()));
788 if (!gp) { 788 if (!gp) {
789 SkDebugf("Could not create GrGeometryProcessor\n"); 789 SkDebugf("Could not create GrGeometryProcessor\n");
790 return; 790 return;
791 } 791 }
792 792
793 batchTarget->initDraw(gp, pipeline); 793 batchTarget->initDraw(gp, this->pipeline());
794 794
795 size_t vertexStride = gp->getVertexStride(); 795 size_t vertexStride = gp->getVertexStride();
796 796
797 SkASSERT(canTweakAlphaForCoverage ? 797 SkASSERT(canTweakAlphaForCoverage ?
798 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt tr) : 798 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorAt tr) :
799 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCo verageAttr)); 799 vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorCo verageAttr));
800 800
801 GrAAConvexTessellator tess; 801 GrAAConvexTessellator tess;
802 802
803 int instanceCount = fGeoData.count(); 803 int instanceCount = fGeoData.count();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 835
836 GrVertices info; 836 GrVertices info;
837 info.initIndexed(kTriangles_GrPrimitiveType, 837 info.initIndexed(kTriangles_GrPrimitiveType,
838 vertexBuffer, indexBuffer, 838 vertexBuffer, indexBuffer,
839 firstVertex, firstIndex, 839 firstVertex, firstIndex,
840 tess.numPts(), tess.numIndices()); 840 tess.numPts(), tess.numIndices());
841 batchTarget->draw(info); 841 batchTarget->draw(info);
842 } 842 }
843 } 843 }
844 844
845 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 845 void generateGeometry(GrBatchTarget* batchTarget) override {
846 #ifndef SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS 846 #ifndef SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS
847 if (this->linesOnly()) { 847 if (this->linesOnly()) {
848 this->generateGeometryLinesOnly(batchTarget, pipeline); 848 this->generateGeometryLinesOnly(batchTarget);
849 return; 849 return;
850 } 850 }
851 #endif 851 #endif
852 852
853 int instanceCount = fGeoData.count(); 853 int instanceCount = fGeoData.count();
854 854
855 SkMatrix invert; 855 SkMatrix invert;
856 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) { 856 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) {
857 SkDebugf("Could not invert viewmatrix\n"); 857 SkDebugf("Could not invert viewmatrix\n");
858 return; 858 return;
859 } 859 }
860 860
861 // Setup GrGeometryProcessor 861 // Setup GrGeometryProcessor
862 SkAutoTUnref<GrGeometryProcessor> quadProcessor( 862 SkAutoTUnref<GrGeometryProcessor> quadProcessor(
863 QuadEdgeEffect::Create(this->color(), invert, this->usesLocalCoo rds())); 863 QuadEdgeEffect::Create(this->color(), invert, this->usesLocalCoo rds()));
864 864
865 batchTarget->initDraw(quadProcessor, pipeline); 865 batchTarget->initDraw(quadProcessor, this->pipeline());
866 866
867 // TODO generate all segments for all paths and use one vertex buffer 867 // TODO generate all segments for all paths and use one vertex buffer
868 for (int i = 0; i < instanceCount; i++) { 868 for (int i = 0; i < instanceCount; i++) {
869 Geometry& args = fGeoData[i]; 869 Geometry& args = fGeoData[i];
870 870
871 // We use the fact that SkPath::transform path does subdivision base d on 871 // We use the fact that SkPath::transform path does subdivision base d on
872 // perspective. Otherwise, we apply the view matrix when copying to the 872 // perspective. Otherwise, we apply the view matrix when copying to the
873 // segment representation. 873 // segment representation.
874 const SkMatrix* viewMatrix = &args.fViewMatrix; 874 const SkMatrix* viewMatrix = &args.fViewMatrix;
875 if (viewMatrix->hasPerspective()) { 875 if (viewMatrix->hasPerspective()) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 BATCH_TEST_DEFINE(AAConvexPathBatch) { 1015 BATCH_TEST_DEFINE(AAConvexPathBatch) {
1016 AAConvexPathBatch::Geometry geometry; 1016 AAConvexPathBatch::Geometry geometry;
1017 geometry.fColor = GrRandomColor(random); 1017 geometry.fColor = GrRandomColor(random);
1018 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1018 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1019 geometry.fPath = GrTest::TestPathConvex(random); 1019 geometry.fPath = GrTest::TestPathConvex(random);
1020 1020
1021 return AAConvexPathBatch::Create(geometry); 1021 return AAConvexPathBatch::Create(geometry);
1022 } 1022 }
1023 1023
1024 #endif 1024 #endif
OLDNEW
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | src/gpu/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698