Chromium Code Reviews| Index: src/gpu/GrDefaultPathRenderer.cpp |
| diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp |
| index e1ba1c84518003e033c683dc8280906d28549126..cf5c46953c00696459a73585f6b04980cfbbae5f 100644 |
| --- a/src/gpu/GrDefaultPathRenderer.cpp |
| +++ b/src/gpu/GrDefaultPathRenderer.cpp |
| @@ -9,6 +9,7 @@ |
| #include "GrBatch.h" |
| #include "GrBatchTarget.h" |
| +#include "GrBatchTest.h" |
| #include "GrBufferAllocPool.h" |
| #include "GrContext.h" |
| #include "GrDefaultGeoProcFactory.h" |
| @@ -748,3 +749,32 @@ void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, |
| SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
| this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, path, stroke, true); |
| } |
| + |
| +/////////////////////////////////////////////////////////////////////////////////////////////////// |
| + |
| +#ifdef GR_TEST_UTILS |
| + |
| +BATCH_TEST_DEFINE(DefaultPathRenderer) { |
| + GrColor color = GrRandomColor(random); |
| + SkMatrix viewMatrix = GrTest::TestMatrix(random); |
| + |
| + // For now just hairlines because the other types of draws require two batches. |
| + // TODO we should figure out a way to combine the stencil and cover steps into one batch |
| + GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
| + SkPath path = GrTest::TestPath(random); |
| + |
| + // Compute srcSpaceTol |
| + SkRect bounds = path.getBounds(); |
| + SkScalar tol = GrPathUtils::kDefaultTolerance; |
| + SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, bounds); |
| + |
| + DefaultPathBatch::Geometry geometry; |
| + geometry.fColor = color; |
| + geometry.fPath = path; |
| + geometry.fTolerance = srcSpaceTol; |
| + |
|
robertphillips
2015/05/07 14:51:51
Do we need to randomize coverage too?
|
| + viewMatrix.mapRect(&bounds); |
| + return DefaultPathBatch::Create(geometry, SK_Scalar1, viewMatrix, true, bounds); |
| +} |
| + |
| +#endif |