Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: src/gpu/GrStencilAndCoverPathRenderer.cpp

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: tiny fix Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrStencilAndCoverPathRenderer.h ('k') | src/gpu/GrStencilAndCoverTextContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrStencilAndCoverPathRenderer.cpp
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index 6ed4b9e61c3e3dc40a8a7d7b4afaaf1a992816f3..022ed949f54ba9e4768f9c0a2a72d91944b55601 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -50,20 +50,22 @@ GrStencilAndCoverPathRenderer::~GrStencilAndCoverPathRenderer() {
fGpu->unref();
}
-bool GrStencilAndCoverPathRenderer::canDrawPath(const SkPath& path,
+bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target,
+ const GrDrawState* drawState,
+ const SkPath& path,
const SkStrokeRec& stroke,
- const GrDrawTarget* target,
bool antiAlias) const {
return !stroke.isHairlineStyle() &&
!antiAlias && // doesn't do per-path AA, relies on the target having MSAA
- target->getDrawState().getRenderTarget()->getStencilBuffer() &&
- target->getDrawState().getStencil().isDisabled();
+ drawState->getRenderTarget()->getStencilBuffer() &&
+ drawState->getStencil().isDisabled();
}
GrPathRenderer::StencilSupport
-GrStencilAndCoverPathRenderer::onGetStencilSupport(const SkPath&,
- const SkStrokeRec& ,
- const GrDrawTarget*) const {
+GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*,
+ const GrDrawState*,
+ const SkPath&,
+ const SkStrokeRec&) const {
return GrPathRenderer::kStencilOnly_StencilSupport;
}
@@ -78,22 +80,23 @@ static GrPath* get_gr_path(GrGpu* gpu, const SkPath& skPath, const SkStrokeRec&
return path.detach();
}
-void GrStencilAndCoverPathRenderer::onStencilPath(const SkPath& path,
- const SkStrokeRec& stroke,
- GrDrawTarget* target) {
+void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target,
+ GrDrawState* drawState,
+ const SkPath& path,
+ const SkStrokeRec& stroke) {
SkASSERT(!path.isInverseFillType());
SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke));
- target->stencilPath(p, convert_skpath_filltype(path.getFillType()));
+ target->stencilPath(drawState, p, convert_skpath_filltype(path.getFillType()));
}
-bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path,
+bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
+ GrDrawState* drawState,
+ const SkPath& path,
const SkStrokeRec& stroke,
- GrDrawTarget* target,
bool antiAlias) {
SkASSERT(!antiAlias);
SkASSERT(!stroke.isHairlineStyle());
- GrDrawState* drawState = target->drawState();
SkASSERT(drawState->getStencil().isDisabled());
SkAutoTUnref<GrPath> p(get_gr_path(fGpu, path, stroke));
@@ -113,7 +116,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path,
drawState->setStencil(kInvertedStencilPass);
// fake inverse with a stencil and cover
- target->stencilPath(p, convert_skpath_filltype(path.getFillType()));
+ target->stencilPath(drawState, p, convert_skpath_filltype(path.getFillType()));
GrDrawState::AutoViewMatrixRestore avmr;
SkRect bounds = SkRect::MakeLTRB(0, 0,
@@ -130,7 +133,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path,
} else {
avmr.setIdentity(drawState);
}
- target->drawSimpleRect(bounds);
+ target->drawSimpleRect(drawState, bounds);
} else {
GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
kZero_StencilOp,
@@ -141,9 +144,9 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path,
0xffff);
drawState->setStencil(kStencilPass);
- target->drawPath(p, convert_skpath_filltype(path.getFillType()));
+ target->drawPath(drawState, p, convert_skpath_filltype(path.getFillType()));
}
- target->drawState()->stencil()->setDisabled();
+ drawState->stencil()->setDisabled();
return true;
}
« no previous file with comments | « src/gpu/GrStencilAndCoverPathRenderer.h ('k') | src/gpu/GrStencilAndCoverTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698