diff options
author | Brian Salomon <bsalomon@google.com> | 2018-07-10 10:07:31 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-10 14:56:05 +0000 |
commit | 653f42f72a1ccb4a5d86cdf128993cbb5c9a310b (patch) | |
tree | 8f3f322166c9b8718f1467007b09a230d98bb4ec /src/gpu/GrPathRenderer.h | |
parent | c098f2bf2fa37ca3eaddc3827d1dcad81f26181c (diff) |
Deinline some GrPathRenderer method and one GrDrawingMananger method.
Removes circular dependencies from coming change.
Some IWYU fallout from removing #includes from GrPathRenderer.h and
GrDrawingManager.h
Bug: skia:
Change-Id: Ice377538e6d64b6a74a59e6140e1de9a58ab99bf
Reviewed-on: https://skia-review.googlesource.com/140181
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrPathRenderer.h')
-rw-r--r-- | src/gpu/GrPathRenderer.h | 114 |
1 files changed, 19 insertions, 95 deletions
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h index 39208bc635..5b59563eda 100644 --- a/src/gpu/GrPathRenderer.h +++ b/src/gpu/GrPathRenderer.h @@ -8,18 +8,23 @@ #ifndef GrPathRenderer_DEFINED #define GrPathRenderer_DEFINED -#include "GrCaps.h" -#include "GrContextPriv.h" -#include "GrPaint.h" -#include "GrRenderTargetContext.h" -#include "GrShape.h" -#include "GrUserStencilSettings.h" -#include "SkDrawProcs.h" +#include "GrTypesPriv.h" #include "SkTArray.h" +#include "SkRefCnt.h" -class SkPath; +class GrCaps; +class GrClip; +class GrContext; class GrFixedClip; class GrHardClip; +class GrPaint; +class GrRenderTargetContext; +class GrShape; +class GrStyle; +struct GrUserStencilSettings; +struct SkIRect; +class SkMatrix; +class SkPath; /** * Base class for drawing paths into a GrOpList. @@ -59,13 +64,7 @@ public: * @param shape the shape that will be drawn. Must be simple fill styled and non-inverse * filled. */ - StencilSupport getStencilSupport(const GrShape& shape) const { - SkDEBUGCODE(SkPath path;) - SkDEBUGCODE(shape.asPath(&path);) - SkASSERT(shape.style().isSimpleFill()); - SkASSERT(!path.isInverseFillType()); - return this->onGetStencilSupport(shape); - } + StencilSupport getStencilSupport(const GrShape& shape) const; enum class CanDrawPath { kNo, @@ -133,33 +132,7 @@ public: * Draws the path into the draw target. If getStencilSupport() would return kNoRestriction then * the subclass must respect the stencil settings. */ - bool drawPath(const DrawPathArgs& args) { - SkDEBUGCODE(args.validate();) -#ifdef SK_DEBUG - CanDrawPathArgs canArgs; - canArgs.fCaps = args.fContext->contextPriv().caps(); - canArgs.fClipConservativeBounds = args.fClipConservativeBounds; - canArgs.fViewMatrix = args.fViewMatrix; - canArgs.fShape = args.fShape; - canArgs.fAAType = args.fAAType; - canArgs.validate(); - - canArgs.fHasUserStencilSettings = !args.fUserStencilSettings->isUnused(); - SkASSERT(!(canArgs.fAAType == GrAAType::kMSAA && - GrFSAAType::kUnifiedMSAA != args.fRenderTargetContext->fsaaType())); - SkASSERT(!(canArgs.fAAType == GrAAType::kMixedSamples && - GrFSAAType::kMixedSamples != args.fRenderTargetContext->fsaaType())); - SkASSERT(CanDrawPath::kNo != this->canDrawPath(canArgs)); - if (!args.fUserStencilSettings->isUnused()) { - SkPath path; - args.fShape->asPath(&path); - SkASSERT(args.fShape->style().isSimpleFill()); - SkASSERT(kNoRestriction_StencilSupport == this->getStencilSupport(*args.fShape)); - } -#endif - return this->onDrawPath(args); - } - + bool drawPath(const DrawPathArgs& args); /** * Args to stencilPath(). fAAType cannot be kCoverage. */ @@ -174,20 +147,7 @@ public: GrAAType fAAType; const GrShape* fShape; -#ifdef SK_DEBUG - void validate() const { - SkASSERT(fContext); - SkASSERT(fRenderTargetContext); - SkASSERT(fClipConservativeBounds); - SkASSERT(fViewMatrix); - SkASSERT(fShape); - SkASSERT(fShape->style().isSimpleFill()); - SkASSERT(GrAAType::kCoverage != fAAType); - SkPath path; - fShape->asPath(&path); - SkASSERT(!path.isInverseFillType()); - } -#endif + SkDEBUGCODE(void validate() const); }; /** @@ -202,21 +162,8 @@ public: // Helper for determining if we can treat a thin stroke as a hairline w/ coverage. // If we can, we draw lots faster (raster device does this same test). - static bool IsStrokeHairlineOrEquivalent(const GrStyle& style, const SkMatrix& matrix, - SkScalar* outCoverage) { - if (style.pathEffect()) { - return false; - } - const SkStrokeRec& stroke = style.strokeRec(); - if (stroke.isHairlineStyle()) { - if (outCoverage) { - *outCoverage = SK_Scalar1; - } - return true; - } - return stroke.getStyle() == SkStrokeRec::kStroke_Style && - SkDrawTreatAAStrokeAsHairline(stroke.getWidth(), matrix, outCoverage); - } + static bool IsStrokeHairlineOrEquivalent(const GrStyle&, const SkMatrix&, + SkScalar* outCoverage); protected: // Helper for getting the device bounds of a path. Inverse filled paths will have bounds set @@ -249,30 +196,7 @@ private: * Subclass implementation of stencilPath(). Subclass must override iff it ever returns * kStencilOnly in onGetStencilSupport(). */ - virtual void onStencilPath(const StencilPathArgs& args) { - static constexpr GrUserStencilSettings kIncrementStencil( - GrUserStencilSettings::StaticInit< - 0xffff, - GrUserStencilTest::kAlways, - 0xffff, - GrUserStencilOp::kReplace, - GrUserStencilOp::kReplace, - 0xffff>() - ); - - GrPaint paint; - DrawPathArgs drawArgs{args.fContext, - std::move(paint), - &kIncrementStencil, - args.fRenderTargetContext, - nullptr, // clip - args.fClipConservativeBounds, - args.fViewMatrix, - args.fShape, - args.fAAType, - false}; - this->drawPath(drawArgs); - } + virtual void onStencilPath(const StencilPathArgs&); typedef SkRefCnt INHERITED; }; |