| OLD | NEW |
| 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 "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
| 9 | 9 |
| 10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 695 |
| 696 SkAutoTUnref<GrBatch> batch(DefaultPathBatch::Create(geometry, newCo
verage, viewMatrix, | 696 SkAutoTUnref<GrBatch> batch(DefaultPathBatch::Create(geometry, newCo
verage, viewMatrix, |
| 697 isHairline, dev
Bounds)); | 697 isHairline, dev
Bounds)); |
| 698 | 698 |
| 699 target->drawBatch(*pipelineBuilder, batch); | 699 target->drawBatch(*pipelineBuilder, batch); |
| 700 } | 700 } |
| 701 } | 701 } |
| 702 return true; | 702 return true; |
| 703 } | 703 } |
| 704 | 704 |
| 705 bool GrDefaultPathRenderer::canDrawPath(const GrDrawTarget* target, | 705 bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
| 706 const GrPipelineBuilder* pipelineBuilder
, | |
| 707 const SkMatrix& viewMatrix, | |
| 708 const SkPath& path, | |
| 709 const GrStrokeInfo& stroke, | |
| 710 bool antiAlias) const { | |
| 711 // this class can draw any path with any fill but doesn't do any anti-aliasi
ng. | 706 // this class can draw any path with any fill but doesn't do any anti-aliasi
ng. |
| 712 return !antiAlias && (stroke.isFillStyle() || IsStrokeHairlineOrEquivalent(s
troke, | 707 return !args.fAntiAlias && (args.fStroke->isFillStyle() || |
| 713 v
iewMatrix, | 708 IsStrokeHairlineOrEquivalent(*args.fStroke, *arg
s.fViewMatrix, |
| 714 N
ULL)); | 709 NULL)); |
| 715 } | 710 } |
| 716 | 711 |
| 717 bool GrDefaultPathRenderer::onDrawPath(GrDrawTarget* target, | 712 bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) { |
| 718 GrPipelineBuilder* pipelineBuilder, | 713 return this->internalDrawPath(args.fTarget, |
| 719 GrColor color, | 714 args.fPipelineBuilder, |
| 720 const SkMatrix& viewMatrix, | 715 args.fColor, |
| 721 const SkPath& path, | 716 *args.fViewMatrix, |
| 722 const GrStrokeInfo& stroke, | 717 *args.fPath, |
| 723 bool antiAlias) { | 718 *args.fStroke, |
| 724 return this->internalDrawPath(target, | |
| 725 pipelineBuilder, | |
| 726 color, | |
| 727 viewMatrix, | |
| 728 path, | |
| 729 stroke, | |
| 730 false); | 719 false); |
| 731 } | 720 } |
| 732 | 721 |
| 733 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, | 722 void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) { |
| 734 GrPipelineBuilder* pipelineBuilder, | 723 SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType()); |
| 735 const SkMatrix& viewMatrix, | 724 SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType()); |
| 736 const SkPath& path, | 725 this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, *
args.fViewMatrix, |
| 737 const GrStrokeInfo& stroke) { | 726 *args.fPath, *args.fStroke, true); |
| 738 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | |
| 739 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | |
| 740 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); | |
| 741 } | 727 } |
| 742 | 728 |
| 743 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 729 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 744 | 730 |
| 745 #ifdef GR_TEST_UTILS | 731 #ifdef GR_TEST_UTILS |
| 746 | 732 |
| 747 BATCH_TEST_DEFINE(DefaultPathBatch) { | 733 BATCH_TEST_DEFINE(DefaultPathBatch) { |
| 748 GrColor color = GrRandomColor(random); | 734 GrColor color = GrRandomColor(random); |
| 749 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 735 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| 750 | 736 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 762 geometry.fColor = color; | 748 geometry.fColor = color; |
| 763 geometry.fPath = path; | 749 geometry.fPath = path; |
| 764 geometry.fTolerance = srcSpaceTol; | 750 geometry.fTolerance = srcSpaceTol; |
| 765 | 751 |
| 766 viewMatrix.mapRect(&bounds); | 752 viewMatrix.mapRect(&bounds); |
| 767 uint8_t coverage = GrRandomCoverage(random); | 753 uint8_t coverage = GrRandomCoverage(random); |
| 768 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 754 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
| 769 } | 755 } |
| 770 | 756 |
| 771 #endif | 757 #endif |
| OLD | NEW |