diff options
Diffstat (limited to 'src/gpu/GrPathRenderer.h')
-rw-r--r-- | src/gpu/GrPathRenderer.h | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h index 0720c3f86a..8f2d465b16 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 |