As part of preliminary groundwork for a chromium fix, this changelist is deprecating GrPathFill so that SkPath::FillType is used everywhere in order to remove some code duplication between Skia and Ganesh.
BUG=chromium:135111
TEST=Try path rendering tests from the gm
Review URL: https://codereview.appspot.com/6875058
git-svn-id: http://skia.googlecode.com/svn/trunk@6693 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index 9749f1d..28e18ed 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -11,6 +11,7 @@
#include "GrContext.h"
#include "GrGpu.h"
#include "GrPath.h"
+#include "SkStroke.h"
GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) {
GrAssert(NULL != context);
@@ -33,42 +34,42 @@
}
bool GrStencilAndCoverPathRenderer::canDrawPath(const SkPath& path,
- GrPathFill fill,
+ const SkStroke& stroke,
const GrDrawTarget* target,
bool antiAlias) const {
- return kHairLine_GrPathFill != fill &&
+ return stroke.getDoFill() &&
!antiAlias && // doesn't do per-path AA, relies on the target having MSAA
target->getDrawState().getStencil().isDisabled();
}
bool GrStencilAndCoverPathRenderer::requiresStencilPass(const SkPath& path,
- GrPathFill fill,
+ const SkStroke& stroke,
const GrDrawTarget* target) const {
return true;
}
void GrStencilAndCoverPathRenderer::drawPathToStencil(const SkPath& path,
- GrPathFill fill,
+ const SkStroke& stroke,
GrDrawTarget* target) {
- GrAssert(kEvenOdd_GrPathFill == fill || kWinding_GrPathFill == fill);
+ GrAssert(!path.isInverseFillType());
SkAutoTUnref<GrPath> p(fGpu->createPath(path));
- target->stencilPath(p, fill);
+ target->stencilPath(p, stroke, path.getFillType());
}
bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path,
- GrPathFill fill,
+ const SkStroke& stroke,
GrDrawTarget* target,
bool antiAlias) {
GrAssert(!antiAlias);
- GrAssert(kHairLine_GrPathFill != fill);
+ GrAssert(0 != stroke.getWidthIfStroked());
GrDrawState* drawState = target->drawState();
GrAssert(drawState->getStencil().isDisabled());
SkAutoTUnref<GrPath> p(fGpu->createPath(path));
- GrPathFill nonInvertedFill = GrNonInvertedFill(fill);
- target->stencilPath(p, nonInvertedFill);
+ SkPath::FillType nonInvertedFill = SkPath::NonInverseFill(path.getFillType());
+ target->stencilPath(p, stroke, nonInvertedFill);
// TODO: Use built in cover operation rather than a rect draw. This will require making our
// fragment shaders be able to eat varyings generated by a matrix.
@@ -78,7 +79,7 @@
SkScalar bloat = drawState->getViewMatrix().getMaxStretch() * SK_ScalarHalf;
GrDrawState::AutoDeviceCoordDraw adcd;
- if (nonInvertedFill == fill) {
+ if (nonInvertedFill == path.getFillType()) {
GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
kZero_StencilOp,
kZero_StencilOp,