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

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

Issue 1265763002: Args structs to GrPathRenderer functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more 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 | « src/gpu/GrAAConvexPathRenderer.h ('k') | src/gpu/GrAADistanceFieldPathRenderer.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 /* 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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 GrGeometryProcessor* QuadEdgeEffect::TestCreate(GrProcessorTestData* d) { 671 GrGeometryProcessor* QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
672 // Doesn't work without derivative instructions. 672 // Doesn't work without derivative instructions.
673 return d->fCaps->shaderCaps()->shaderDerivativeSupport() ? 673 return d->fCaps->shaderCaps()->shaderDerivativeSupport() ?
674 QuadEdgeEffect::Create(GrRandomColor(d->fRandom), 674 QuadEdgeEffect::Create(GrRandomColor(d->fRandom),
675 GrTest::TestMatrix(d->fRandom), 675 GrTest::TestMatrix(d->fRandom),
676 d->fRandom->nextBool()) : NULL; 676 d->fRandom->nextBool()) : NULL;
677 } 677 }
678 678
679 /////////////////////////////////////////////////////////////////////////////// 679 ///////////////////////////////////////////////////////////////////////////////
680 680
681 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target, 681 bool GrAAConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
682 const GrPipelineBuilder*, 682 return (args.fTarget->caps()->shaderCaps()->shaderDerivativeSupport() && arg s.fAntiAlias &&
683 const SkMatrix& viewMatrix, 683 args.fStroke->isFillStyle() && !args.fPath->isInverseFillType() &&
684 const SkPath& path, 684 args.fPath->isConvex());
685 const GrStrokeInfo& stroke,
686 bool antiAlias) const {
687 return (target->caps()->shaderCaps()->shaderDerivativeSupport() && antiAlias &&
688 stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex() );
689 } 685 }
690 686
691 // extract the result vertices and indices from the GrAAConvexTessellator 687 // extract the result vertices and indices from the GrAAConvexTessellator
692 static void extract_verts(const GrAAConvexTessellator& tess, 688 static void extract_verts(const GrAAConvexTessellator& tess,
693 void* vertices, 689 void* vertices,
694 size_t vertexStride, 690 size_t vertexStride,
695 GrColor color, 691 GrColor color,
696 uint16_t* idxs, 692 uint16_t* idxs,
697 bool tweakAlphaForCoverage) { 693 bool tweakAlphaForCoverage) {
698 intptr_t verts = reinterpret_cast<intptr_t>(vertices); 694 intptr_t verts = reinterpret_cast<intptr_t>(vertices);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 bool fColorIgnored; 977 bool fColorIgnored;
982 bool fCoverageIgnored; 978 bool fCoverageIgnored;
983 bool fLinesOnly; 979 bool fLinesOnly;
984 bool fCanTweakAlphaForCoverage; 980 bool fCanTweakAlphaForCoverage;
985 }; 981 };
986 982
987 BatchTracker fBatch; 983 BatchTracker fBatch;
988 SkSTArray<1, Geometry, true> fGeoData; 984 SkSTArray<1, Geometry, true> fGeoData;
989 }; 985 };
990 986
991 bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target, 987 bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
992 GrPipelineBuilder* pipelineBuilder, 988 if (args.fPath->isEmpty()) {
993 GrColor color,
994 const SkMatrix& vm,
995 const SkPath& path,
996 const GrStrokeInfo&,
997 bool antiAlias) {
998 if (path.isEmpty()) {
999 return true; 989 return true;
1000 } 990 }
1001 991
1002 AAConvexPathBatch::Geometry geometry; 992 AAConvexPathBatch::Geometry geometry;
1003 geometry.fColor = color; 993 geometry.fColor = args.fColor;
1004 geometry.fViewMatrix = vm; 994 geometry.fViewMatrix = *args.fViewMatrix;
1005 geometry.fPath = path; 995 geometry.fPath = *args.fPath;
1006 996
1007 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); 997 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
1008 target->drawBatch(*pipelineBuilder, batch); 998 args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
1009 999
1010 return true; 1000 return true;
1011 1001
1012 } 1002 }
1013 1003
1014 //////////////////////////////////////////////////////////////////////////////// /////////////////// 1004 //////////////////////////////////////////////////////////////////////////////// ///////////////////
1015 1005
1016 #ifdef GR_TEST_UTILS 1006 #ifdef GR_TEST_UTILS
1017 1007
1018 BATCH_TEST_DEFINE(AAConvexPathBatch) { 1008 BATCH_TEST_DEFINE(AAConvexPathBatch) {
1019 AAConvexPathBatch::Geometry geometry; 1009 AAConvexPathBatch::Geometry geometry;
1020 geometry.fColor = GrRandomColor(random); 1010 geometry.fColor = GrRandomColor(random);
1021 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1011 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1022 geometry.fPath = GrTest::TestPathConvex(random); 1012 geometry.fPath = GrTest::TestPathConvex(random);
1023 1013
1024 return AAConvexPathBatch::Create(geometry); 1014 return AAConvexPathBatch::Create(geometry);
1025 } 1015 }
1026 1016
1027 #endif 1017 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.h ('k') | src/gpu/GrAADistanceFieldPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698