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

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

Issue 1096513002: Pass dashing information to path rasterizers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 100-col issue 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
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 "SkStrokeRec.h"
24 #include "SkTraceEvent.h" 25 #include "SkTraceEvent.h"
25 #include "gl/GrGLProcessor.h" 26 #include "gl/GrGLProcessor.h"
26 #include "gl/GrGLSL.h" 27 #include "gl/GrGLSL.h"
27 #include "gl/GrGLGeometryProcessor.h" 28 #include "gl/GrGLGeometryProcessor.h"
28 #include "gl/builders/GrGLProgramBuilder.h" 29 #include "gl/builders/GrGLProgramBuilder.h"
29 30
30 GrAAConvexPathRenderer::GrAAConvexPathRenderer() { 31 GrAAConvexPathRenderer::GrAAConvexPathRenderer() {
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 QuadEdgeEffect::Create(GrRandomColor(random), 676 QuadEdgeEffect::Create(GrRandomColor(random),
676 GrProcessorUnitTest::TestMatrix(random)) : NUL L; 677 GrProcessorUnitTest::TestMatrix(random)) : NUL L;
677 } 678 }
678 679
679 /////////////////////////////////////////////////////////////////////////////// 680 ///////////////////////////////////////////////////////////////////////////////
680 681
681 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target, 682 bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target,
682 const GrPipelineBuilder*, 683 const GrPipelineBuilder*,
683 const SkMatrix& viewMatrix, 684 const SkMatrix& viewMatrix,
684 const SkPath& path, 685 const SkPath& path,
685 const SkStrokeRec& stroke, 686 const GrStrokeInfo& stroke,
686 bool antiAlias) const { 687 bool antiAlias) const {
687 return (target->caps()->shaderDerivativeSupport() && antiAlias && 688 return (target->caps()->shaderDerivativeSupport() && antiAlias &&
688 stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex() ); 689 stroke.getStrokeRec().isFillStyle() && !path.isInverseFillType() && path.isConvex());
689 } 690 }
690 691
691 class AAConvexPathBatch : public GrBatch { 692 class AAConvexPathBatch : public GrBatch {
692 public: 693 public:
693 struct Geometry { 694 struct Geometry {
694 GrColor fColor; 695 GrColor fColor;
695 SkMatrix fViewMatrix; 696 SkMatrix fViewMatrix;
696 SkPath fPath; 697 SkPath fPath;
697 }; 698 };
698 699
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 863
863 BatchTracker fBatch; 864 BatchTracker fBatch;
864 SkSTArray<1, Geometry, true> fGeoData; 865 SkSTArray<1, Geometry, true> fGeoData;
865 }; 866 };
866 867
867 bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target, 868 bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
868 GrPipelineBuilder* pipelineBuilder, 869 GrPipelineBuilder* pipelineBuilder,
869 GrColor color, 870 GrColor color,
870 const SkMatrix& vm, 871 const SkMatrix& vm,
871 const SkPath& path, 872 const SkPath& path,
872 const SkStrokeRec&, 873 const GrStrokeInfo&,
873 bool antiAlias) { 874 bool antiAlias) {
874 if (path.isEmpty()) { 875 if (path.isEmpty()) {
875 return true; 876 return true;
876 } 877 }
877 878
878 // We outset our vertices one pixel and add one more pixel for precision. 879 // We outset our vertices one pixel and add one more pixel for precision.
879 // TODO create tighter bounds when we start reordering. 880 // TODO create tighter bounds when we start reordering.
880 SkRect devRect = path.getBounds(); 881 SkRect devRect = path.getBounds();
881 vm.mapRect(&devRect); 882 vm.mapRect(&devRect);
882 devRect.outset(2, 2); 883 devRect.outset(2, 2);
883 884
884 AAConvexPathBatch::Geometry geometry; 885 AAConvexPathBatch::Geometry geometry;
885 geometry.fColor = color; 886 geometry.fColor = color;
886 geometry.fViewMatrix = vm; 887 geometry.fViewMatrix = vm;
887 geometry.fPath = path; 888 geometry.fPath = path;
888 889
889 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); 890 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
890 target->drawBatch(pipelineBuilder, batch, &devRect); 891 target->drawBatch(pipelineBuilder, batch, &devRect);
891 892
892 return true; 893 return true;
893 894
894 } 895 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698