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

Side by Side Diff: src/gpu/GrAAHairLinePathRenderer.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/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrAALinearizingConvexPathRenderer.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 2011 Google Inc. 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" 8 #include "GrAAHairLinePathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 for (int i = 0; i < kLineSegNumVertices; ++i) { 609 for (int i = 0; i < kLineSegNumVertices; ++i) {
610 (*vert)[i].fPos.set(SK_ScalarMax, SK_ScalarMax); 610 (*vert)[i].fPos.set(SK_ScalarMax, SK_ScalarMax);
611 } 611 }
612 } 612 }
613 613
614 *vert += kLineSegNumVertices; 614 *vert += kLineSegNumVertices;
615 } 615 }
616 616
617 /////////////////////////////////////////////////////////////////////////////// 617 ///////////////////////////////////////////////////////////////////////////////
618 618
619 bool GrAAHairLinePathRenderer::canDrawPath(const GrDrawTarget* target, 619 bool GrAAHairLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
620 const GrPipelineBuilder* pipelineBuil der, 620 if (!args.fAntiAlias) {
621 const SkMatrix& viewMatrix,
622 const SkPath& path,
623 const GrStrokeInfo& stroke,
624 bool antiAlias) const {
625 if (!antiAlias) {
626 return false; 621 return false;
627 } 622 }
628 623
629 if (!IsStrokeHairlineOrEquivalent(stroke, viewMatrix, NULL)) { 624 if (!IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, NULL)) {
630 return false; 625 return false;
631 } 626 }
632 627
633 if (SkPath::kLine_SegmentMask == path.getSegmentMasks() || 628 if (SkPath::kLine_SegmentMask == args.fPath->getSegmentMasks() ||
634 target->caps()->shaderCaps()->shaderDerivativeSupport()) { 629 args.fTarget->caps()->shaderCaps()->shaderDerivativeSupport()) {
635 return true; 630 return true;
636 } 631 }
637 return false; 632 return false;
638 } 633 }
639 634
640 template <class VertexType> 635 template <class VertexType>
641 bool check_bounds(const SkMatrix& viewMatrix, const SkRect& devBounds, void* ver tices, int vCount) 636 bool check_bounds(const SkMatrix& viewMatrix, const SkRect& devBounds, void* ver tices, int vCount)
642 { 637 {
643 SkRect tolDevBounds = devBounds; 638 SkRect tolDevBounds = devBounds;
644 // The bounds ought to be tight, but in perspective the below code runs the verts 639 // The bounds ought to be tight, but in perspective the below code runs the verts
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 AAHairlineBatch::Geometry geometry; 962 AAHairlineBatch::Geometry geometry;
968 geometry.fColor = color; 963 geometry.fColor = color;
969 geometry.fCoverage = newCoverage; 964 geometry.fCoverage = newCoverage;
970 geometry.fViewMatrix = viewMatrix; 965 geometry.fViewMatrix = viewMatrix;
971 geometry.fPath = path; 966 geometry.fPath = path;
972 geometry.fDevClipBounds = devClipBounds; 967 geometry.fDevClipBounds = devClipBounds;
973 968
974 return AAHairlineBatch::Create(geometry); 969 return AAHairlineBatch::Create(geometry);
975 } 970 }
976 971
977 bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target, 972 bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
978 GrPipelineBuilder* pipelineBuilder,
979 GrColor color,
980 const SkMatrix& viewMatrix,
981 const SkPath& path,
982 const GrStrokeInfo& stroke,
983 bool) {
984 SkIRect devClipBounds; 973 SkIRect devClipBounds;
985 pipelineBuilder->clip().getConservativeBounds(pipelineBuilder->getRenderTarg et(), 974 args.fPipelineBuilder->clip().getConservativeBounds(args.fPipelineBuilder->g etRenderTarget(),
986 &devClipBounds); 975 &devClipBounds);
987 976
988 SkAutoTUnref<GrBatch> batch(create_hairline_batch(color, viewMatrix, path, s troke, 977 SkAutoTUnref<GrBatch> batch(create_hairline_batch(args.fColor, *args.fViewMa trix, *args.fPath,
989 devClipBounds)); 978 *args.fStroke, devClipBoun ds));
990 target->drawBatch(*pipelineBuilder, batch); 979 args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
991 980
992 return true; 981 return true;
993 } 982 }
994 983
995 //////////////////////////////////////////////////////////////////////////////// /////////////////// 984 //////////////////////////////////////////////////////////////////////////////// ///////////////////
996 985
997 #ifdef GR_TEST_UTILS 986 #ifdef GR_TEST_UTILS
998 987
999 BATCH_TEST_DEFINE(AAHairlineBatch) { 988 BATCH_TEST_DEFINE(AAHairlineBatch) {
1000 GrColor color = GrRandomColor(random); 989 GrColor color = GrRandomColor(random);
1001 SkMatrix viewMatrix = GrTest::TestMatrix(random); 990 SkMatrix viewMatrix = GrTest::TestMatrix(random);
1002 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); 991 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle);
1003 SkPath path = GrTest::TestPath(random); 992 SkPath path = GrTest::TestPath(random);
1004 SkIRect devClipBounds; 993 SkIRect devClipBounds;
1005 devClipBounds.setEmpty(); 994 devClipBounds.setEmpty();
1006 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ; 995 return create_hairline_batch(color, viewMatrix, path, stroke, devClipBounds) ;
1007 } 996 }
1008 997
1009 #endif 998 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.h ('k') | src/gpu/GrAALinearizingConvexPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698