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" |
11 #include "GrBatchTarget.h" | 11 #include "GrBatchTarget.h" |
12 #include "GrBatchTest.h" | |
12 #include "GrBufferAllocPool.h" | 13 #include "GrBufferAllocPool.h" |
13 #include "GrContext.h" | 14 #include "GrContext.h" |
14 #include "GrDefaultGeoProcFactory.h" | 15 #include "GrDefaultGeoProcFactory.h" |
15 #include "GrPathUtils.h" | 16 #include "GrPathUtils.h" |
16 #include "GrPipelineBuilder.h" | 17 #include "GrPipelineBuilder.h" |
17 #include "GrVertices.h" | 18 #include "GrVertices.h" |
18 #include "SkGeometry.h" | 19 #include "SkGeometry.h" |
19 #include "SkString.h" | 20 #include "SkString.h" |
20 #include "SkStrokeRec.h" | 21 #include "SkStrokeRec.h" |
21 #include "SkTLazy.h" | 22 #include "SkTLazy.h" |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 | 742 |
742 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, | 743 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, |
743 GrPipelineBuilder* pipelineBuilder, | 744 GrPipelineBuilder* pipelineBuilder, |
744 const SkMatrix& viewMatrix, | 745 const SkMatrix& viewMatrix, |
745 const SkPath& path, | 746 const SkPath& path, |
746 const GrStrokeInfo& stroke) { | 747 const GrStrokeInfo& stroke) { |
747 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | 748 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); |
748 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | 749 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
749 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p ath, stroke, true); | 750 this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, p ath, stroke, true); |
750 } | 751 } |
752 | |
753 //////////////////////////////////////////////////////////////////////////////// /////////////////// | |
754 | |
755 #ifdef GR_TEST_UTILS | |
756 | |
757 BATCH_TEST_DEFINE(DefaultPathRenderer) { | |
758 GrColor color = GrRandomColor(random); | |
759 SkMatrix viewMatrix = GrTest::TestMatrix(random); | |
760 | |
761 // For now just hairlines because the other types of draws require two batch es. | |
762 // TODO we should figure out a way to combine the stencil and cover steps in to one batch | |
763 GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); | |
764 SkPath path = GrTest::TestPath(random); | |
765 | |
766 // Compute srcSpaceTol | |
767 SkRect bounds = path.getBounds(); | |
768 SkScalar tol = GrPathUtils::kDefaultTolerance; | |
769 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bou nds); | |
770 | |
771 DefaultPathBatch::Geometry geometry; | |
772 geometry.fColor = color; | |
773 geometry.fPath = path; | |
774 geometry.fTolerance = srcSpaceTol; | |
775 | |
robertphillips
2015/05/07 14:51:51
Do we need to randomize coverage too?
| |
776 viewMatrix.mapRect(&bounds); | |
777 return DefaultPathBatch::Create(geometry, SK_Scalar1, viewMatrix, true, boun ds); | |
778 } | |
779 | |
780 #endif | |
OLD | NEW |