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>
This commit is contained in:
Brian Salomon 2018-07-10 10:07:31 -04:00 committed by Skia Commit-Bot
parent c098f2bf2f
commit 653f42f72a
23 changed files with 171 additions and 123 deletions

View File

@ -6,7 +6,6 @@
*/
#include "GrClipStackClip.h"
#include "GrAppliedClip.h"
#include "GrContextPriv.h"
#include "GrDeferredProxyUploader.h"
@ -16,7 +15,9 @@
#include "GrProxyProvider.h"
#include "GrRenderTargetContextPriv.h"
#include "GrSWMaskHelper.h"
#include "GrShape.h"
#include "GrStencilAttachment.h"
#include "GrStyle.h"
#include "GrTextureProxy.h"
#include "SkClipOpPriv.h"
#include "SkMakeUnique.h"

View File

@ -528,6 +528,13 @@ GrCoverageCountingPathRenderer* GrDrawingManager::getCoverageCountingPathRendere
return fPathRendererChain->getCoverageCountingPathRenderer();
}
void GrDrawingManager::flushIfNecessary() {
GrResourceCache* resourceCache = fContext->contextPriv().getResourceCache();
if (resourceCache && resourceCache->requestsFlush()) {
this->internalFlush(nullptr, GrResourceCache::kCacheRequested, 0, nullptr);
}
}
sk_sp<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext(
sk_sp<GrSurfaceProxy> sProxy,
sk_sp<SkColorSpace> colorSpace,

View File

@ -10,7 +10,6 @@
#include "GrPathRenderer.h"
#include "GrPathRendererChain.h"
#include "GrRenderTargetOpList.h"
#include "GrResourceCache.h"
#include "SkTArray.h"
#include "text/GrTextContext.h"
@ -21,9 +20,11 @@ class GrOnFlushCallbackObject;
class GrRenderTargetContext;
class GrRenderTargetProxy;
class GrSingleOWner;
class GrRenderTargetOpList;
class GrSoftwarePathRenderer;
class GrTextureContext;
class GrTextureOpList;
class SkDeferredDisplayList;
// The GrDrawingManager allocates a new GrRenderTargetContext for each GrRenderTarget
// but all of them still land in the same GrOpList!
@ -65,12 +66,7 @@ public:
// supported and turned on.
GrCoverageCountingPathRenderer* getCoverageCountingPathRenderer();
void flushIfNecessary() {
GrResourceCache* resourceCache = fContext->contextPriv().getResourceCache();
if (resourceCache && resourceCache->requestsFlush()) {
this->internalFlush(nullptr, GrResourceCache::kCacheRequested, 0, nullptr);
}
}
void flushIfNecessary();
static bool ProgramUnitTest(GrContext* context, int maxStages, int maxLevels);

View File

@ -6,10 +6,10 @@
*/
#include "GrOnFlushResourceProvider.h"
#include "GrContextPriv.h"
#include "GrDrawingManager.h"
#include "GrProxyProvider.h"
#include "GrRenderTargetContext.h"
#include "GrSurfaceProxy.h"
sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(

View File

@ -6,9 +6,84 @@
*/
#include "GrPathRenderer.h"
#include "GrCaps.h"
#include "GrContextPriv.h"
#include "GrPaint.h"
#include "GrRenderTargetContext.h"
#include "GrShape.h"
#include "GrUserStencilSettings.h"
#include "SkDrawProcs.h"
GrPathRenderer::GrPathRenderer() {
#ifdef SK_DEBUG
void GrPathRenderer::StencilPathArgs::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
//////////////////////////////////////////////////////////////////////////////
GrPathRenderer::GrPathRenderer() {}
GrPathRenderer::StencilSupport GrPathRenderer::getStencilSupport(const GrShape& shape) const {
SkDEBUGCODE(SkPath path;)
SkDEBUGCODE(shape.asPath(&path);)
SkASSERT(shape.style().isSimpleFill());
SkASSERT(!path.isInverseFillType());
return this->onGetStencilSupport(shape);
}
bool GrPathRenderer::drawPath(const DrawPathArgs& args) {
#ifdef SK_DEBUG
args.validate();
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 GrPathRenderer::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);
}
void GrPathRenderer::GetPathDevBounds(const SkPath& path,
int devW, int devH,
@ -21,3 +96,28 @@ void GrPathRenderer::GetPathDevBounds(const SkPath& path,
*bounds = path.getBounds();
matrix.mapRect(bounds);
}
void GrPathRenderer::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);
}

View File

@ -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;
};

View File

@ -6,18 +6,18 @@
*/
#include "GrReducedClip.h"
#include "GrAppliedClip.h"
#include "GrClip.h"
#include "GrColor.h"
#include "GrContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
#include "GrDrawingManager.h"
#include "GrFixedClip.h"
#include "GrPathRenderer.h"
#include "GrStencilSettings.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
#include "GrShape.h"
#include "GrStencilClip.h"
#include "GrStencilSettings.h"
#include "GrStyle.h"
#include "GrUserStencilSettings.h"
#include "SkClipOpPriv.h"

View File

@ -22,7 +22,9 @@
#include "GrRenderTarget.h"
#include "GrRenderTargetContextPriv.h"
#include "GrResourceProvider.h"
#include "GrShape.h"
#include "GrStencilAttachment.h"
#include "GrStyle.h"
#include "GrTracing.h"
#include "SkDrawShadowInfo.h"
#include "SkGr.h"

View File

@ -14,8 +14,9 @@
#include "GrOpFlushState.h"
#include "GrOpList.h"
#include "GrProxyProvider.h"
#include "GrSurfaceContextPriv.h"
#include "GrSWMaskHelper.h"
#include "GrShape.h"
#include "GrSurfaceContextPriv.h"
#include "SkMakeUnique.h"
#include "SkSemaphore.h"
#include "SkTaskGroup.h"

View File

@ -11,6 +11,7 @@
#include "GrPathRenderer.h"
class GrProxyProvider;
class GrTextureProxy;
/**
* This class uses the software side to render a path to an SkBitmap and

View File

@ -6,7 +6,8 @@
*/
#include "GrCCDrawPathsOp.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrMemoryPool.h"
#include "GrOpFlushState.h"
#include "ccpr/GrCCPathCache.h"

View File

@ -8,11 +8,12 @@
#ifndef GrCoverageCountingPathRenderer_DEFINED
#define GrCoverageCountingPathRenderer_DEFINED
#include <map>
#include "GrCCPerOpListPaths.h"
#include "GrOnFlushResourceProvider.h"
#include "GrPathRenderer.h"
#include "GrRenderTargetOpList.h"
#include "ccpr/GrCCPerFlushResources.h"
#include <map>
class GrCCDrawPathsOp;
class GrCCPathCache;

View File

@ -6,7 +6,6 @@
*/
#include "GrAAConvexPathRenderer.h"
#include "GrAAConvexTessellator.h"
#include "GrCaps.h"
#include "GrContext.h"
@ -16,6 +15,8 @@
#include "GrOpFlushState.h"
#include "GrPathUtils.h"
#include "GrProcessor.h"
#include "GrRenderTargetContext.h"
#include "GrShape.h"
#include "GrSimpleMeshDrawOpHelper.h"
#include "SkGeometry.h"
#include "SkPathPriv.h"

View File

@ -16,7 +16,9 @@
#include "GrPathUtils.h"
#include "GrProcessor.h"
#include "GrResourceProvider.h"
#include "GrShape.h"
#include "GrSimpleMeshDrawOpHelper.h"
#include "GrStyle.h"
#include "SkGeometry.h"
#include "SkMatrixPriv.h"
#include "SkPoint3.h"

View File

@ -14,6 +14,8 @@
#include "GrOpFlushState.h"
#include "GrPathUtils.h"
#include "GrProcessor.h"
#include "GrRenderTargetContext.h"
#include "GrShape.h"
#include "GrStyle.h"
#include "SkGeometry.h"
#include "SkPathPriv.h"

View File

@ -6,9 +6,10 @@
*/
#include "GrDashLinePathRenderer.h"
#include "GrAuditTrail.h"
#include "GrGpu.h"
#include "GrRenderTargetContext.h"
#include "GrShape.h"
#include "ops/GrDashOp.h"
#include "ops/GrMeshDrawOp.h"

View File

@ -13,7 +13,9 @@
#include "GrMesh.h"
#include "GrOpFlushState.h"
#include "GrPathUtils.h"
#include "GrShape.h"
#include "GrSimpleMeshDrawOpHelper.h"
#include "GrStyle.h"
#include "GrSurfaceContextPriv.h"
#include "SkGeometry.h"
#include "SkString.h"

View File

@ -12,11 +12,14 @@
#include "GrDistanceFieldGenFromVector.h"
#include "GrDrawOpTest.h"
#include "GrQuad.h"
#include "GrRenderTargetContext.h"
#include "GrResourceProvider.h"
#include "GrSimpleMeshDrawOpHelper.h"
#include "SkAutoMalloc.h"
#include "SkAutoPixmapStorage.h"
#include "SkDistanceFieldGen.h"
#include "SkDraw.h"
#include "SkPaint.h"
#include "SkPointPriv.h"
#include "SkRasterClip.h"
#include "effects/GrBitmapTextGeoProc.h"

View File

@ -14,6 +14,7 @@
#include "GrPath.h"
#include "GrRenderTargetContextPriv.h"
#include "GrResourceProvider.h"
#include "GrShape.h"
#include "GrStencilClip.h"
#include "GrStencilPathOp.h"
#include "GrStyle.h"

View File

@ -12,6 +12,7 @@
class GrContext;
class GrGpu;
class GrResourceProvider;
/**
* Uses GrGpu::stencilPath followed by a cover rectangle. This subclass doesn't apply AA; it relies

View File

@ -6,7 +6,7 @@
*/
#include "GrTessellatingPathRenderer.h"
#include <stdio.h>
#include "GrAuditTrail.h"
#include "GrClip.h"
#include "GrDefaultGeoProcFactory.h"
@ -16,14 +16,13 @@
#include "GrPathUtils.h"
#include "GrResourceCache.h"
#include "GrResourceProvider.h"
#include "GrShape.h"
#include "GrSimpleMeshDrawOpHelper.h"
#include "GrStyle.h"
#include "GrTessellator.h"
#include "SkGeometry.h"
#include "GrSimpleMeshDrawOpHelper.h"
#include "ops/GrMeshDrawOp.h"
#include <stdio.h>
#ifndef GR_AA_TESSELLATOR_MAX_VERB_COUNT
#define GR_AA_TESSELLATOR_MAX_VERB_COUNT 10
#endif

View File

@ -7,13 +7,14 @@
#include "Test.h"
#include "SkPath.h"
#include "GrClip.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrResourceCache.h"
#include "GrShape.h"
#include "GrSoftwarePathRenderer.h"
#include "GrStyle.h"
#include "SkPath.h"
#include "effects/GrPorterDuffXferProcessor.h"
#include "ops/GrTessellatingPathRenderer.h"

View File

@ -7,12 +7,13 @@
#include "Test.h"
#include "SkPath.h"
#include "GrClip.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrShape.h"
#include "GrStyle.h"
#include "SkGradientShader.h"
#include "SkPath.h"
#include "SkShaderBase.h"
#include "effects/GrPorterDuffXferProcessor.h"
#include "ops/GrTessellatingPathRenderer.h"