| 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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 const GrStrokeInfo& stroke) { | 742 const GrStrokeInfo& stroke) { |
| 743 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | 743 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); |
| 744 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | 744 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
| 745 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); | 745 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p
ath, stroke, true); |
| 746 } | 746 } |
| 747 | 747 |
| 748 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 748 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 749 | 749 |
| 750 #ifdef GR_TEST_UTILS | 750 #ifdef GR_TEST_UTILS |
| 751 | 751 |
| 752 BATCH_TEST_DEFINE(DefaultPathRenderer) { | 752 BATCH_TEST_DEFINE(DefaultPathBatch) { |
| 753 GrColor color = GrRandomColor(random); | 753 GrColor color = GrRandomColor(random); |
| 754 SkMatrix viewMatrix = GrTest::TestMatrix(random); | 754 SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| 755 | 755 |
| 756 // For now just hairlines because the other types of draws require two batch
es. | 756 // For now just hairlines because the other types of draws require two batch
es. |
| 757 // TODO we should figure out a way to combine the stencil and cover steps in
to one batch | 757 // TODO we should figure out a way to combine the stencil and cover steps in
to one batch |
| 758 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | 758 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
| 759 SkPath path = GrTest::TestPath(random); | 759 SkPath path = GrTest::TestPath(random); |
| 760 | 760 |
| 761 // Compute srcSpaceTol | 761 // Compute srcSpaceTol |
| 762 SkRect bounds = path.getBounds(); | 762 SkRect bounds = path.getBounds(); |
| 763 SkScalar tol = GrPathUtils::kDefaultTolerance; | 763 SkScalar tol = GrPathUtils::kDefaultTolerance; |
| 764 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou
nds); | 764 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou
nds); |
| 765 | 765 |
| 766 DefaultPathBatch::Geometry geometry; | 766 DefaultPathBatch::Geometry geometry; |
| 767 geometry.fColor = color; | 767 geometry.fColor = color; |
| 768 geometry.fPath = path; | 768 geometry.fPath = path; |
| 769 geometry.fTolerance = srcSpaceTol; | 769 geometry.fTolerance = srcSpaceTol; |
| 770 | 770 |
| 771 viewMatrix.mapRect(&bounds); | 771 viewMatrix.mapRect(&bounds); |
| 772 uint8_t coverage = GrRandomCoverage(random); | 772 uint8_t coverage = GrRandomCoverage(random); |
| 773 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 773 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
| 774 } | 774 } |
| 775 | 775 |
| 776 #endif | 776 #endif |
| OLD | NEW |