| OLD | NEW |
| 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 |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 typedef GrGeometryProcessor INHERITED; | 664 typedef GrGeometryProcessor INHERITED; |
| 665 }; | 665 }; |
| 666 | 666 |
| 667 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); | 667 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); |
| 668 | 668 |
| 669 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, | 669 GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, |
| 670 GrContext*, | 670 GrContext*, |
| 671 const GrDrawTargetCaps& caps, | 671 const GrDrawTargetCaps& caps, |
| 672 GrTexture*[]) { | 672 GrTexture*[]) { |
| 673 // Doesn't work without derivative instructions. | 673 // Doesn't work without derivative instructions. |
| 674 return caps.shaderDerivativeSupport() ? | 674 return caps.shaderCaps()->shaderDerivativeSupport() ? |
| 675 QuadEdgeEffect::Create(GrRandomColor(random), | 675 QuadEdgeEffect::Create(GrRandomColor(random), |
| 676 GrTest::TestMatrix(random)) : NULL; | 676 GrTest::TestMatrix(random)) : NULL; |
| 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 GrStrokeInfo& stroke, | 685 const GrStrokeInfo& stroke, |
| 686 bool antiAlias) const { | 686 bool antiAlias) const { |
| 687 return (target->caps()->shaderDerivativeSupport() && antiAlias && | 687 return (target->caps()->shaderCaps()->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; |
| 696 SkPath fPath; | 696 SkPath fPath; |
| 697 }; | 697 }; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |