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

Side by Side Diff: src/gpu/batches/GrAAHairLinePathRenderer.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
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 "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 *vert += kLineSegNumVertices; 611 *vert += kLineSegNumVertices;
612 } 612 }
613 613
614 /////////////////////////////////////////////////////////////////////////////// 614 ///////////////////////////////////////////////////////////////////////////////
615 615
616 bool GrAAHairLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { 616 bool GrAAHairLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
617 if (!args.fAntiAlias) { 617 if (!args.fAntiAlias) {
618 return false; 618 return false;
619 } 619 }
620 620
621 if (!IsStrokeHairlineOrEquivalent(*args.fStyle, *args.fViewMatrix, nullptr)) { 621 if (!IsStrokeHairlineOrEquivalent(args.fShape->style(), *args.fViewMatrix, n ullptr)) {
622 return false; 622 return false;
623 } 623 }
624 624
625 // We don't currently handle dashing in this class though perhaps we should. 625 // We don't currently handle dashing in this class though perhaps we should.
626 if (args.fStyle->pathEffect()) { 626 if (args.fShape->style().pathEffect()) {
627 return false; 627 return false;
628 } 628 }
629 629
630 if (SkPath::kLine_SegmentMask == args.fPath->getSegmentMasks() || 630 if (SkPath::kLine_SegmentMask == args.fShape->segmentMask() ||
631 args.fShaderCaps->shaderDerivativeSupport()) { 631 args.fShaderCaps->shaderDerivativeSupport()) {
632 return true; 632 return true;
633 } 633 }
634
634 return false; 635 return false;
635 } 636 }
636 637
637 template <class VertexType> 638 template <class VertexType>
638 bool check_bounds(const SkMatrix& viewMatrix, const SkRect& devBounds, void* ver tices, int vCount) 639 bool check_bounds(const SkMatrix& viewMatrix, const SkRect& devBounds, void* ver tices, int vCount)
639 { 640 {
640 SkRect tolDevBounds = devBounds; 641 SkRect tolDevBounds = devBounds;
641 // The bounds ought to be tight, but in perspective the below code runs the verts 642 // The bounds ought to be tight, but in perspective the below code runs the verts
642 // through the view matrix to get back to dev coords, which can introduce im precision. 643 // through the view matrix to get back to dev coords, which can introduce im precision.
643 if (viewMatrix.hasPerspective()) { 644 if (viewMatrix.hasPerspective()) {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 965
965 bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) { 966 bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
966 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), 967 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
967 "GrAAHairlinePathRenderer::onDrawPath"); 968 "GrAAHairlinePathRenderer::onDrawPath");
968 SkASSERT(!args.fDrawContext->isUnifiedMultisampled()); 969 SkASSERT(!args.fDrawContext->isUnifiedMultisampled());
969 970
970 SkIRect devClipBounds; 971 SkIRect devClipBounds;
971 args.fClip->getConservativeBounds(args.fDrawContext->width(), args.fDrawCont ext->height(), 972 args.fClip->getConservativeBounds(args.fDrawContext->width(), args.fDrawCont ext->height(),
972 &devClipBounds); 973 &devClipBounds);
973 974
974 SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fColor, *args.fVi ewMatrix, *args.fPath, 975 SkPath path;
975 *args.fStyle, devClipB ounds)); 976 args.fShape->asPath(&path);
977 SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fColor, *args.fVi ewMatrix, path,
978 args.fShape->style(), devClipBounds));
976 979
977 GrPipelineBuilder pipelineBuilder(*args.fPaint); 980 GrPipelineBuilder pipelineBuilder(*args.fPaint);
978 pipelineBuilder.setUserStencil(args.fUserStencilSettings); 981 pipelineBuilder.setUserStencil(args.fUserStencilSettings);
979
980 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); 982 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
981 983
982 return true; 984 return true;
983 } 985 }
984 986
985 //////////////////////////////////////////////////////////////////////////////// /////////////////// 987 //////////////////////////////////////////////////////////////////////////////// ///////////////////
986 988
987 #ifdef GR_TEST_UTILS 989 #ifdef GR_TEST_UTILS
988 990
989 DRAW_BATCH_TEST_DEFINE(AAHairlineBatch) { 991 DRAW_BATCH_TEST_DEFINE(AAHairlineBatch) {
990 GrColor color = GrRandomColor(random); 992 GrColor color = GrRandomColor(random);
991 SkMatrix viewMatrix = GrTest::TestMatrix(random); 993 SkMatrix viewMatrix = GrTest::TestMatrix(random);
992 SkPath path = GrTest::TestPath(random); 994 SkPath path = GrTest::TestPath(random);
993 SkIRect devClipBounds; 995 SkIRect devClipBounds;
994 devClipBounds.setEmpty(); 996 devClipBounds.setEmpty();
995 return create_hairline_batch(color, viewMatrix, path, GrStyle::SimpleHairlin e(), devClipBounds); 997 return create_hairline_batch(color, viewMatrix, path, GrStyle::SimpleHairlin e(), devClipBounds);
996 } 998 }
997 999
998 #endif 1000 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698