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

Side by Side Diff: src/gpu/batches/GrPLSPathRenderer.cpp

Issue 2006643005: Start on replacing path+style with shape in patherenderer (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: rebase after breaking out more Created 4 years, 6 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/batches/GrMSAAPathRenderer.cpp ('k') | src/gpu/batches/GrStencilAndCoverPathRenderer.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 "GrPLSPathRenderer.h" 8 #include "GrPLSPathRenderer.h"
9 9
10 #include "SkChunkAlloc.h" 10 #include "SkChunkAlloc.h"
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 bool fUsesLocalCoords; 770 bool fUsesLocalCoords;
771 771
772 typedef GrGeometryProcessor INHERITED; 772 typedef GrGeometryProcessor INHERITED;
773 }; 773 };
774 774
775 /////////////////////////////////////////////////////////////////////////////// 775 ///////////////////////////////////////////////////////////////////////////////
776 776
777 bool GrPLSPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { 777 bool GrPLSPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
778 // We have support for even-odd rendering, but are having some troublesome 778 // We have support for even-odd rendering, but are having some troublesome
779 // seams. Disable in the presence of even-odd for now. 779 // seams. Disable in the presence of even-odd for now.
780 SkPath path;
781 args.fShape->asPath(&path);
780 return args.fShaderCaps->shaderDerivativeSupport() && args.fAntiAlias && 782 return args.fShaderCaps->shaderDerivativeSupport() && args.fAntiAlias &&
781 args.fStyle->isSimpleFill() && !args.fPath->isInverseFillType() && 783 args.fShape->style().isSimpleFill() && !path.isInverseFillType() &&
782 args.fPath->getFillType() == SkPath::FillType::kWinding_FillType; 784 path.getFillType() == SkPath::FillType::kWinding_FillType;
783 } 785 }
784 786
785 class PLSPathBatch : public GrVertexBatch { 787 class PLSPathBatch : public GrVertexBatch {
786 public: 788 public:
787 DEFINE_BATCH_CLASS_ID 789 DEFINE_BATCH_CLASS_ID
788 struct Geometry { 790 struct Geometry {
789 GrColor fColor; 791 GrColor fColor;
790 SkMatrix fViewMatrix; 792 SkMatrix fViewMatrix;
791 SkPath fPath; 793 SkPath fPath;
792 }; 794 };
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 }; 969 };
968 970
969 BatchTracker fBatch; 971 BatchTracker fBatch;
970 SkSTArray<1, Geometry, true> fGeoData; 972 SkSTArray<1, Geometry, true> fGeoData;
971 973
972 typedef GrVertexBatch INHERITED; 974 typedef GrVertexBatch INHERITED;
973 }; 975 };
974 976
975 SkDEBUGCODE(bool inPLSDraw = false;) 977 SkDEBUGCODE(bool inPLSDraw = false;)
976 bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) { 978 bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) {
977 if (args.fPath->isEmpty()) { 979 SkASSERT(!args.fShape->isEmpty())
978 return true;
979 }
980 SkASSERT(!inPLSDraw); 980 SkASSERT(!inPLSDraw);
981 SkDEBUGCODE(inPLSDraw = true;) 981 SkDEBUGCODE(inPLSDraw = true;)
982 PLSPathBatch::Geometry geometry; 982 PLSPathBatch::Geometry geometry;
983 geometry.fColor = args.fColor; 983 geometry.fColor = args.fColor;
984 geometry.fViewMatrix = *args.fViewMatrix; 984 geometry.fViewMatrix = *args.fViewMatrix;
985 geometry.fPath = *args.fPath; 985 args.fShape->asPath(&geometry.fPath);
986 986
987 SkAutoTUnref<GrDrawBatch> batch(PLSPathBatch::Create(geometry)); 987 SkAutoTUnref<GrDrawBatch> batch(PLSPathBatch::Create(geometry));
988 988
989 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->mustUseHW AA(*args.fPaint)); 989 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->mustUseHW AA(*args.fPaint));
990 pipelineBuilder.setUserStencil(args.fUserStencilSettings); 990 pipelineBuilder.setUserStencil(args.fUserStencilSettings);
991 991
992 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); 992 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
993 993
994 SkDEBUGCODE(inPLSDraw = false;) 994 SkDEBUGCODE(inPLSDraw = false;)
995 return true; 995 return true;
996 996
997 } 997 }
998 998
999 //////////////////////////////////////////////////////////////////////////////// /////////////////// 999 //////////////////////////////////////////////////////////////////////////////// ///////////////////
1000 1000
1001 #ifdef GR_TEST_UTILS 1001 #ifdef GR_TEST_UTILS
1002 1002
1003 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) { 1003 DRAW_BATCH_TEST_DEFINE(PLSPathBatch) {
1004 PLSPathBatch::Geometry geometry; 1004 PLSPathBatch::Geometry geometry;
1005 geometry.fColor = GrRandomColor(random); 1005 geometry.fColor = GrRandomColor(random);
1006 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1006 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1007 geometry.fPath = GrTest::TestPathConvex(random); 1007 geometry.fPath = GrTest::TestPathConvex(random);
1008 1008
1009 return PLSPathBatch::Create(geometry); 1009 return PLSPathBatch::Create(geometry);
1010 } 1010 }
1011 1011
1012 #endif 1012 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrMSAAPathRenderer.cpp ('k') | src/gpu/batches/GrStencilAndCoverPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698