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

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

Issue 1100073003: Extract gpu line dashing to GrDashLinePathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address review comments Created 5 years, 8 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
11 #include "GrBatch.h" 11 #include "GrBatch.h"
12 #include "GrBatchTarget.h" 12 #include "GrBatchTarget.h"
13 #include "GrBufferAllocPool.h" 13 #include "GrBufferAllocPool.h"
14 #include "GrContext.h" 14 #include "GrContext.h"
15 #include "GrDrawTargetCaps.h" 15 #include "GrDrawTargetCaps.h"
16 #include "GrGeometryProcessor.h" 16 #include "GrGeometryProcessor.h"
17 #include "GrInvariantOutput.h" 17 #include "GrInvariantOutput.h"
18 #include "GrPathUtils.h" 18 #include "GrPathUtils.h"
19 #include "GrProcessor.h" 19 #include "GrProcessor.h"
20 #include "GrPipelineBuilder.h" 20 #include "GrPipelineBuilder.h"
21 #include "GrStrokeInfo.h"
21 #include "SkGeometry.h" 22 #include "SkGeometry.h"
22 #include "SkString.h" 23 #include "SkString.h"
23 #include "SkStrokeRec.h"
24 #include "SkTraceEvent.h" 24 #include "SkTraceEvent.h"
25 #include "gl/GrGLProcessor.h" 25 #include "gl/GrGLProcessor.h"
26 #include "gl/GrGLSL.h" 26 #include "gl/GrGLSL.h"
27 #include "gl/GrGLGeometryProcessor.h" 27 #include "gl/GrGLGeometryProcessor.h"
28 #include "gl/builders/GrGLProgramBuilder.h" 28 #include "gl/builders/GrGLProgramBuilder.h"
29 29
30 GrAAConvexPathRenderer::GrAAConvexPathRenderer() { 30 GrAAConvexPathRenderer::GrAAConvexPathRenderer() {
31 } 31 }
32 32
33 struct Segment { 33 struct Segment {
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 QuadEdgeEffect::Create(GrRandomColor(random), 675 QuadEdgeEffect::Create(GrRandomColor(random),
676 GrProcessorUnitTest::TestMatrix(random)) : NUL L; 676 GrProcessorUnitTest::TestMatrix(random)) : NUL L;
677 } 677 }
678 678
679 /////////////////////////////////////////////////////////////////////////////// 679 ///////////////////////////////////////////////////////////////////////////////
680 680
681 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target, 681 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target,
682 const GrPipelineBuilder*, 682 const GrPipelineBuilder*,
683 const SkMatrix& viewMatrix, 683 const SkMatrix& viewMatrix,
684 const SkPath& path, 684 const SkPath& path,
685 const SkStrokeRec& stroke, 685 const GrStrokeInfo& stroke,
686 bool antiAlias) const { 686 bool antiAlias) const {
687 return (target->caps()->shaderDerivativeSupport() && antiAlias && 687 return (target->caps()->shaderDerivativeSupport() && antiAlias &&
688 stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex() ); 688 stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex() );
689 } 689 }
690 690
691 class AAConvexPathBatch : public GrBatch { 691 class AAConvexPathBatch : public GrBatch {
692 public: 692 public:
693 struct Geometry { 693 struct Geometry {
694 GrColor fColor; 694 GrColor fColor;
695 SkMatrix fViewMatrix; 695 SkMatrix fViewMatrix;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 862
863 BatchTracker fBatch; 863 BatchTracker fBatch;
864 SkSTArray<1, Geometry, true> fGeoData; 864 SkSTArray<1, Geometry, true> fGeoData;
865 }; 865 };
866 866
867 bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target, 867 bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
868 GrPipelineBuilder* pipelineBuilder, 868 GrPipelineBuilder* pipelineBuilder,
869 GrColor color, 869 GrColor color,
870 const SkMatrix& vm, 870 const SkMatrix& vm,
871 const SkPath& path, 871 const SkPath& path,
872 const SkStrokeRec&, 872 const GrStrokeInfo&,
873 bool antiAlias) { 873 bool antiAlias) {
874 if (path.isEmpty()) { 874 if (path.isEmpty()) {
875 return true; 875 return true;
876 } 876 }
877 877
878 // We outset our vertices one pixel and add one more pixel for precision. 878 // We outset our vertices one pixel and add one more pixel for precision.
879 // TODO create tighter bounds when we start reordering. 879 // TODO create tighter bounds when we start reordering.
880 SkRect devRect = path.getBounds(); 880 SkRect devRect = path.getBounds();
881 vm.mapRect(&devRect); 881 vm.mapRect(&devRect);
882 devRect.outset(2, 2); 882 devRect.outset(2, 2);
883 883
884 AAConvexPathBatch::Geometry geometry; 884 AAConvexPathBatch::Geometry geometry;
885 geometry.fColor = color; 885 geometry.fColor = color;
886 geometry.fViewMatrix = vm; 886 geometry.fViewMatrix = vm;
887 geometry.fPath = path; 887 geometry.fPath = path;
888 888
889 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); 889 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
890 target->drawBatch(pipelineBuilder, batch, &devRect); 890 target->drawBatch(pipelineBuilder, batch, &devRect);
891 891
892 return true; 892 return true;
893 893
894 } 894 }
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