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

Unified Diff: src/gpu/GrPathRenderer.h

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/GrOvalRenderer.cpp ('k') | src/gpu/GrPathRendererChain.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPathRenderer.h
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index 0720c3f86a950f766ecbca6464f49f37db9d8fad..8f2d465b16dbc70d95160b71b564c796fe350447 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -81,11 +81,12 @@ public:
* @param path the path that will be drawn
* @param stroke the stroke information (width, join, cap).
*/
- StencilSupport getStencilSupport(const SkPath& path,
- const SkStrokeRec& stroke,
- const GrDrawTarget* target) const {
+ StencilSupport getStencilSupport(const GrDrawTarget* target,
+ const GrDrawState* drawState,
+ const SkPath& path,
+ const SkStrokeRec& stroke) const {
SkASSERT(!path.isInverseFillType());
- return this->onGetStencilSupport(path, stroke, target);
+ return this->onGetStencilSupport(target, drawState, path, stroke);
}
/**
@@ -100,9 +101,10 @@ public:
*
* @return true if the path can be drawn by this object, false otherwise.
*/
- virtual bool canDrawPath(const SkPath& path,
+ virtual bool canDrawPath(const GrDrawTarget* target,
+ const GrDrawState* drawState,
+ const SkPath& path,
const SkStrokeRec& rec,
- const GrDrawTarget* target,
bool antiAlias) const = 0;
/**
* Draws the path into the draw target. If getStencilSupport() would return kNoRestriction then
@@ -113,15 +115,17 @@ public:
* @param target target that the path will be rendered to
* @param antiAlias true if anti-aliasing is required.
*/
- bool drawPath(const SkPath& path,
+ bool drawPath(GrDrawTarget* target,
+ GrDrawState* ds,
+ const SkPath& path,
const SkStrokeRec& stroke,
- GrDrawTarget* target,
bool antiAlias) {
SkASSERT(!path.isEmpty());
- SkASSERT(this->canDrawPath(path, stroke, target, antiAlias));
- SkASSERT(target->drawState()->getStencil().isDisabled() ||
- kNoRestriction_StencilSupport == this->getStencilSupport(path, stroke, target));
- return this->onDrawPath(path, stroke, target, antiAlias);
+ SkASSERT(this->canDrawPath(target, ds, path, stroke, antiAlias));
+ SkASSERT(ds->getStencil().isDisabled() ||
+ kNoRestriction_StencilSupport == this->getStencilSupport(target, ds, path,
+ stroke));
+ return this->onDrawPath(target, ds, path, stroke, antiAlias);
}
/**
@@ -132,10 +136,13 @@ public:
* @param stroke the stroke information (width, join, cap)
* @param target target that the path will be rendered to
*/
- void stencilPath(const SkPath& path, const SkStrokeRec& stroke, GrDrawTarget* target) {
+ void stencilPath(GrDrawTarget* target,
+ GrDrawState* ds,
+ const SkPath& path,
+ const SkStrokeRec& stroke) {
SkASSERT(!path.isEmpty());
- SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(path, stroke, target));
- this->onStencilPath(path, stroke, target);
+ SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(target, ds, path, stroke));
+ this->onStencilPath(target, ds, path, stroke);
}
// Helper for determining if we can treat a thin stroke as a hairline w/ coverage.
@@ -156,27 +163,30 @@ protected:
/**
* Subclass overrides if it has any limitations of stenciling support.
*/
- virtual StencilSupport onGetStencilSupport(const SkPath&,
- const SkStrokeRec&,
- const GrDrawTarget*) const {
+ virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
+ const GrDrawState*,
+ const SkPath&,
+ const SkStrokeRec&) const {
return kNoRestriction_StencilSupport;
}
/**
* Subclass implementation of drawPath()
*/
- virtual bool onDrawPath(const SkPath& path,
- const SkStrokeRec& stroke,
- GrDrawTarget* target,
+ virtual bool onDrawPath(GrDrawTarget*,
+ GrDrawState*,
+ const SkPath&,
+ const SkStrokeRec&,
bool antiAlias) = 0;
/**
* Subclass implementation of stencilPath(). Subclass must override iff it ever returns
* kStencilOnly in onGetStencilSupport().
*/
- virtual void onStencilPath(const SkPath& path, const SkStrokeRec& stroke, GrDrawTarget* target) {
- GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kPreserve_ASRInit);
- GrDrawState* drawState = target->drawState();
+ virtual void onStencilPath(GrDrawTarget* target,
+ GrDrawState* drawState,
+ const SkPath& path,
+ const SkStrokeRec& stroke) {
GR_STATIC_CONST_SAME_STENCIL(kIncrementStencil,
kReplace_StencilOp,
kReplace_StencilOp,
@@ -186,7 +196,7 @@ protected:
0xffff);
drawState->setStencil(kIncrementStencil);
drawState->enableState(GrDrawState::kNoColorWrites_StateBit);
- this->drawPath(path, stroke, target, false);
+ this->drawPath(target, drawState, path, stroke, false);
}
// Helper for getting the device bounds of a path. Inverse filled paths will have bounds set
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrPathRendererChain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698