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

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

Issue 2081383006: Use GrShape in GrPathRenderer. (Closed) Base URL: https://chromium.googlesource.com/skia.git@shapemembers
Patch Set: Address comments 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/GrStyle.h ('k') | src/gpu/batches/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 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "GrAAConvexPathRenderer.h" 8 #include "GrAAConvexPathRenderer.h"
9 9
10 #include "GrAAConvexTessellator.h" 10 #include "GrAAConvexTessellator.h"
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 return d->fCaps->shaderCaps()->shaderDerivativeSupport() ? 674 return d->fCaps->shaderCaps()->shaderDerivativeSupport() ?
675 QuadEdgeEffect::Make(GrRandomColor(d->fRandom), 675 QuadEdgeEffect::Make(GrRandomColor(d->fRandom),
676 GrTest::TestMatrix(d->fRandom), 676 GrTest::TestMatrix(d->fRandom),
677 d->fRandom->nextBool()) : nullptr; 677 d->fRandom->nextBool()) : nullptr;
678 } 678 }
679 679
680 /////////////////////////////////////////////////////////////////////////////// 680 ///////////////////////////////////////////////////////////////////////////////
681 681
682 bool GrAAConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { 682 bool GrAAConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
683 return (args.fShaderCaps->shaderDerivativeSupport() && args.fAntiAlias && 683 return (args.fShaderCaps->shaderDerivativeSupport() && args.fAntiAlias &&
684 args.fStyle->isSimpleFill() && !args.fPath->isInverseFillType() && 684 args.fShape->style().isSimpleFill() && !args.fShape->inverseFilled() &&
685 args.fPath->isConvex()); 685 args.fShape->knownToBeConvex());
686 } 686 }
687 687
688 // extract the result vertices and indices from the GrAAConvexTessellator 688 // extract the result vertices and indices from the GrAAConvexTessellator
689 static void extract_verts(const GrAAConvexTessellator& tess, 689 static void extract_verts(const GrAAConvexTessellator& tess,
690 void* vertices, 690 void* vertices,
691 size_t vertexStride, 691 size_t vertexStride,
692 GrColor color, 692 GrColor color,
693 uint16_t* idxs, 693 uint16_t* idxs,
694 bool tweakAlphaForCoverage) { 694 bool tweakAlphaForCoverage) {
695 intptr_t verts = reinterpret_cast<intptr_t>(vertices); 695 intptr_t verts = reinterpret_cast<intptr_t>(vertices);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 BatchTracker fBatch; 991 BatchTracker fBatch;
992 SkSTArray<1, Geometry, true> fGeoData; 992 SkSTArray<1, Geometry, true> fGeoData;
993 993
994 typedef GrVertexBatch INHERITED; 994 typedef GrVertexBatch INHERITED;
995 }; 995 };
996 996
997 bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) { 997 bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
998 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), 998 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
999 "GrAAConvexPathRenderer::onDrawPath"); 999 "GrAAConvexPathRenderer::onDrawPath");
1000 SkASSERT(!args.fDrawContext->isUnifiedMultisampled()); 1000 SkASSERT(!args.fDrawContext->isUnifiedMultisampled());
1001 1001 SkASSERT(!args.fShape->isEmpty());
1002 if (args.fPath->isEmpty()) {
1003 return true;
1004 }
1005 1002
1006 AAConvexPathBatch::Geometry geometry; 1003 AAConvexPathBatch::Geometry geometry;
1007 geometry.fColor = args.fColor; 1004 geometry.fColor = args.fColor;
1008 geometry.fViewMatrix = *args.fViewMatrix; 1005 geometry.fViewMatrix = *args.fViewMatrix;
1009 geometry.fPath = *args.fPath; 1006 args.fShape->asPath(&geometry.fPath);
1010 1007
1011 SkAutoTUnref<GrDrawBatch> batch(AAConvexPathBatch::Create(geometry)); 1008 SkAutoTUnref<GrDrawBatch> batch(AAConvexPathBatch::Create(geometry));
1012 1009
1013 GrPipelineBuilder pipelineBuilder(*args.fPaint); 1010 GrPipelineBuilder pipelineBuilder(*args.fPaint);
1014 pipelineBuilder.setUserStencil(args.fUserStencilSettings); 1011 pipelineBuilder.setUserStencil(args.fUserStencilSettings);
1015 1012
1016 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); 1013 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch);
1017 1014
1018 return true; 1015 return true;
1019 1016
1020 } 1017 }
1021 1018
1022 //////////////////////////////////////////////////////////////////////////////// /////////////////// 1019 //////////////////////////////////////////////////////////////////////////////// ///////////////////
1023 1020
1024 #ifdef GR_TEST_UTILS 1021 #ifdef GR_TEST_UTILS
1025 1022
1026 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { 1023 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) {
1027 AAConvexPathBatch::Geometry geometry; 1024 AAConvexPathBatch::Geometry geometry;
1028 geometry.fColor = GrRandomColor(random); 1025 geometry.fColor = GrRandomColor(random);
1029 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1026 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1030 geometry.fPath = GrTest::TestPathConvex(random); 1027 geometry.fPath = GrTest::TestPathConvex(random);
1031 1028
1032 return AAConvexPathBatch::Create(geometry); 1029 return AAConvexPathBatch::Create(geometry);
1033 } 1030 }
1034 1031
1035 #endif 1032 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrStyle.h ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698