aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/gpu/GrAAConvexPathRenderer.cpp2
-rwxr-xr-xsrc/gpu/GrAADistanceFieldPathRenderer.cpp10
-rwxr-xr-xsrc/gpu/GrAADistanceFieldPathRenderer.h7
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.cpp2
-rw-r--r--src/gpu/GrDashLinePathRenderer.h7
-rw-r--r--src/gpu/GrDefaultPathRenderer.cpp5
-rw-r--r--src/gpu/GrDefaultPathRenderer.h5
-rw-r--r--src/gpu/GrPathRenderer.h85
-rw-r--r--src/gpu/GrPathRendererChain.cpp4
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp8
-rw-r--r--src/gpu/GrSoftwarePathRenderer.h7
-rw-r--r--src/gpu/GrStencilAndCoverPathRenderer.cpp8
-rw-r--r--src/gpu/GrStencilAndCoverPathRenderer.h7
-rw-r--r--src/gpu/GrTessellatingPathRenderer.cpp8
-rw-r--r--src/gpu/GrTessellatingPathRenderer.h7
15 files changed, 65 insertions, 107 deletions
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 3d2ff456d7..b5bea9f553 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -679,7 +679,7 @@ GrGeometryProcessor* QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
///////////////////////////////////////////////////////////////////////////////
bool GrAAConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
- return (args.fTarget->caps()->shaderCaps()->shaderDerivativeSupport() && args.fAntiAlias &&
+ return (args.fShaderCaps->shaderDerivativeSupport() && args.fAntiAlias &&
args.fStroke->isFillStyle() && !args.fPath->isInverseFillType() &&
args.fPath->isConvex());
}
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index 0428373a89..50116dd3cb 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -85,7 +85,7 @@ bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
// TODO: Support inverse fill
// TODO: Support strokes
- if (!args.fTarget->caps()->shaderCaps()->shaderDerivativeSupport() || !args.fAntiAlias ||
+ if (!args.fShaderCaps->shaderDerivativeSupport() || !args.fAntiAlias ||
args.fPath->isInverseFillType() || args.fPath->isVolatile() ||
!args.fStroke->isFillStyle()) {
return false;
@@ -104,14 +104,6 @@ bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
return maxDim < 64.f && maxDim * maxScale < 256.f;
}
-GrPathRenderer::StencilSupport
-GrAADistanceFieldPathRenderer::onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const {
- return GrPathRenderer::kNoSupport_StencilSupport;
-}
-
////////////////////////////////////////////////////////////////////////////////
// padding around path bounds to allow for antialiased pixels
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.h b/src/gpu/GrAADistanceFieldPathRenderer.h
index 30846e433e..469aeeb981 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.h
+++ b/src/gpu/GrAADistanceFieldPathRenderer.h
@@ -24,10 +24,9 @@ public:
virtual ~GrAADistanceFieldPathRenderer();
private:
- StencilSupport onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const override;
+ StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ return GrPathRenderer::kNoSupport_StencilSupport;
+ }
bool onCanDrawPath(const CanDrawPathArgs&) const override;
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index df0095eaba..bfdff8dd86 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -627,7 +627,7 @@ bool GrAAHairLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const
}
if (SkPath::kLine_SegmentMask == args.fPath->getSegmentMasks() ||
- args.fTarget->caps()->shaderCaps()->shaderDerivativeSupport()) {
+ args.fShaderCaps->shaderDerivativeSupport()) {
return true;
}
return false;
diff --git a/src/gpu/GrDashLinePathRenderer.h b/src/gpu/GrDashLinePathRenderer.h
index 2e37665e51..f21c73b688 100644
--- a/src/gpu/GrDashLinePathRenderer.h
+++ b/src/gpu/GrDashLinePathRenderer.h
@@ -15,11 +15,8 @@ class GrDashLinePathRenderer : public GrPathRenderer {
private:
bool onCanDrawPath(const CanDrawPathArgs&) const override;
- StencilSupport onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const override {
- return kNoSupport_StencilSupport;
+ StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ return kNoSupport_StencilSupport;
}
bool onDrawPath(const DrawPathArgs&) override;
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index 50fd20ac79..1dd9deb891 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -169,10 +169,7 @@ static inline bool single_pass_path(const SkPath& path, const SkStrokeRec& strok
}
GrPathRenderer::StencilSupport
-GrDefaultPathRenderer::onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath& path,
- const GrStrokeInfo& stroke) const {
+GrDefaultPathRenderer::onGetStencilSupport(const SkPath& path, const GrStrokeInfo& stroke) const {
if (single_pass_path(path, stroke)) {
return GrPathRenderer::kNoRestriction_StencilSupport;
} else {
diff --git a/src/gpu/GrDefaultPathRenderer.h b/src/gpu/GrDefaultPathRenderer.h
index 2c1545ff70..8f82f25b09 100644
--- a/src/gpu/GrDefaultPathRenderer.h
+++ b/src/gpu/GrDefaultPathRenderer.h
@@ -21,10 +21,7 @@ public:
private:
- virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const override;
+ StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override;
bool onCanDrawPath(const CanDrawPathArgs&) const override;
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index e353d6876f..50cf748302 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -77,21 +77,17 @@ public:
* This function is to get the stencil support for a particular path. The path's fill must
* not be an inverse type.
*
- * @param target target that the path will be rendered to
* @param path the path that will be drawn
* @param stroke the stroke information (width, join, cap).
*/
- StencilSupport getStencilSupport(const GrDrawTarget* target,
- const GrPipelineBuilder* pipelineBuilder,
- const SkPath& path,
- const GrStrokeInfo& stroke) const {
+ StencilSupport getStencilSupport(const SkPath& path, const GrStrokeInfo& stroke) const {
SkASSERT(!path.isInverseFillType());
- return this->onGetStencilSupport(target, pipelineBuilder, path, stroke);
+ return this->onGetStencilSupport(path, stroke);
}
/** Args to canDrawPath()
*
- * fTarget The target that the path will be rendered to
+ * fShaderCaps The shader caps
* fPipelineBuilder The pipelineBuilder
* fViewMatrix The viewMatrix
* fPath The path to draw
@@ -99,12 +95,21 @@ public:
* fAntiAlias True if anti-aliasing is required.
*/
struct CanDrawPathArgs {
- const GrDrawTarget* fTarget;
- const GrPipelineBuilder* fPipelineBuilder;
+ const GrShaderCaps* fShaderCaps;
+ const GrPipelineBuilder* fPipelineBuilder;// only used by GrStencilAndCoverPathRenderer
const SkMatrix* fViewMatrix;
const SkPath* fPath;
const GrStrokeInfo* fStroke;
bool fAntiAlias;
+
+ void validate() const {
+ SkASSERT(fShaderCaps);
+ SkASSERT(fPipelineBuilder);
+ SkASSERT(fViewMatrix);
+ SkASSERT(fPath);
+ SkASSERT(fStroke);
+ SkASSERT(!fPath->isEmpty());
+ }
};
/**
@@ -115,12 +120,7 @@ public:
* @return true if the path can be drawn by this object, false otherwise.
*/
bool canDrawPath(const CanDrawPathArgs& args) const {
- SkASSERT(args.fTarget);
- SkASSERT(args.fPipelineBuilder);
- SkASSERT(args.fViewMatrix);
- SkASSERT(args.fPath);
- SkASSERT(args.fStroke);
- SkASSERT(!args.fPath->isEmpty());
+ SkDEBUGCODE(args.validate();)
return this->onCanDrawPath(args);
}
@@ -144,6 +144,16 @@ public:
const SkPath* fPath;
const GrStrokeInfo* fStroke;
bool fAntiAlias;
+
+ void validate() const {
+ SkASSERT(fTarget);
+ SkASSERT(fResourceProvider);
+ SkASSERT(fPipelineBuilder);
+ SkASSERT(fViewMatrix);
+ SkASSERT(fPath);
+ SkASSERT(fStroke);
+ SkASSERT(!fPath->isEmpty());
+ }
};
/**
@@ -151,16 +161,10 @@ public:
* the subclass must respect the stencil settings of the GrPipelineBuilder.
*/
bool drawPath(const DrawPathArgs& args) {
- SkASSERT(args.fTarget);
- SkASSERT(args.fPipelineBuilder);
- SkASSERT(args.fViewMatrix);
- SkASSERT(args.fPath);
- SkASSERT(args.fStroke);
-
- SkASSERT(!args.fPath->isEmpty());
+ SkDEBUGCODE(args.validate();)
#ifdef SK_DEBUG
CanDrawPathArgs canArgs;
- canArgs.fTarget = args.fTarget;
+ canArgs.fShaderCaps = args.fTarget->caps()->shaderCaps();
canArgs.fPipelineBuilder = args.fPipelineBuilder;
canArgs.fViewMatrix = args.fViewMatrix;
canArgs.fPath = args.fPath;
@@ -168,9 +172,7 @@ public:
canArgs.fAntiAlias = args.fAntiAlias;
SkASSERT(this->canDrawPath(canArgs));
SkASSERT(args.fPipelineBuilder->getStencil().isDisabled() ||
- kNoRestriction_StencilSupport == this->getStencilSupport(args.fTarget,
- args.fPipelineBuilder,
- *args.fPath,
+ kNoRestriction_StencilSupport == this->getStencilSupport(*args.fPath,
*args.fStroke));
#endif
return this->onDrawPath(args);
@@ -179,6 +181,7 @@ public:
/* Args to stencilPath().
*
* fTarget The target that the path will be rendered to.
+ * fResourceProvider The resource provider for creating gpu resources to render the path
* fPipelineBuilder The pipeline builder.
* fViewMatrix Matrix applied to the path.
* fPath The path to draw.
@@ -186,11 +189,21 @@ public:
*/
struct StencilPathArgs {
GrDrawTarget* fTarget;
- GrPipelineBuilder* fPipelineBuilder;
GrResourceProvider* fResourceProvider;
+ GrPipelineBuilder* fPipelineBuilder;
const SkMatrix* fViewMatrix;
const SkPath* fPath;
const GrStrokeInfo* fStroke;
+
+ void validate() const {
+ SkASSERT(fTarget);
+ SkASSERT(fResourceProvider);
+ SkASSERT(fPipelineBuilder);
+ SkASSERT(fViewMatrix);
+ SkASSERT(fPath);
+ SkASSERT(fStroke);
+ SkASSERT(!fPath->isEmpty());
+ }
};
/**
@@ -199,16 +212,9 @@ public:
*
*/
void stencilPath(const StencilPathArgs& args) {
- SkASSERT(args.fTarget);
- SkASSERT(args.fPipelineBuilder);
- SkASSERT(args.fResourceProvider);
- SkASSERT(args.fViewMatrix);
- SkASSERT(args.fPath);
- SkASSERT(args.fStroke);
- SkASSERT(!args.fPath->isEmpty());
- SkASSERT(kNoSupport_StencilSupport !=
- this->getStencilSupport(args.fTarget, args.fPipelineBuilder, *args.fPath,
- *args.fStroke));
+ SkDEBUGCODE(args.validate();)
+ SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(*args.fPath, *args.fStroke));
+
this->onStencilPath(args);
}
@@ -250,10 +256,7 @@ private:
/**
* Subclass overrides if it has any limitations of stenciling support.
*/
- virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const {
+ virtual StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const {
return kNoRestriction_StencilSupport;
}
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 9bfa752e21..f5788511bd 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -61,7 +61,7 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
for (int i = 0; i < fChain.count(); ++i) {
GrPathRenderer::CanDrawPathArgs args;
- args.fTarget = target;
+ args.fShaderCaps = target->caps()->shaderCaps();
args.fPipelineBuilder = pipelineBuilder;
args.fViewMatrix = &viewMatrix;
args.fPath = &path;
@@ -70,7 +70,7 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
if (fChain[i]->canDrawPath(args)) {
if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
GrPathRenderer::StencilSupport support =
- fChain[i]->getStencilSupport(target, pipelineBuilder, path, stroke);
+ fChain[i]->getStencilSupport(path, stroke);
if (support < minStencilSupport) {
continue;
} else if (stencilSupport) {
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 401246ea5c..6e2babc259 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -22,14 +22,6 @@ bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
return true;
}
-GrPathRenderer::StencilSupport
-GrSoftwarePathRenderer::onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const {
- return GrPathRenderer::kNoSupport_StencilSupport;
-}
-
namespace {
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrSoftwarePathRenderer.h b/src/gpu/GrSoftwarePathRenderer.h
index d7991b84a3..72a95152e2 100644
--- a/src/gpu/GrSoftwarePathRenderer.h
+++ b/src/gpu/GrSoftwarePathRenderer.h
@@ -23,10 +23,9 @@ public:
: fContext(context) {
}
private:
- virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const override;
+ StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ return GrPathRenderer::kNoSupport_StencilSupport;
+ }
bool onCanDrawPath(const CanDrawPathArgs&) const override;
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index 4d92fb20c2..f871c3da73 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -59,14 +59,6 @@ bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
}
}
-GrPathRenderer::StencilSupport
-GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const {
- return GrPathRenderer::kStencilOnly_StencilSupport;
-}
-
static GrPath* get_gr_path(GrResourceProvider* resourceProvider, const SkPath& skPath,
const GrStrokeInfo& stroke) {
GrUniqueKey key;
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.h b/src/gpu/GrStencilAndCoverPathRenderer.h
index 5b6ce41dd8..bb8cdb0dd7 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.h
+++ b/src/gpu/GrStencilAndCoverPathRenderer.h
@@ -25,10 +25,9 @@ public:
private:
- StencilSupport onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const override;
+ StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ return GrPathRenderer::kStencilOnly_StencilSupport;
+ }
bool onCanDrawPath(const CanDrawPathArgs&) const override;
diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp
index 480952119b..9459cc55d1 100644
--- a/src/gpu/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/GrTessellatingPathRenderer.cpp
@@ -1360,14 +1360,6 @@ bool cache_match(GrVertexBuffer* vertexBuffer, SkScalar tol, int* actualCount) {
GrTessellatingPathRenderer::GrTessellatingPathRenderer() {
}
-GrPathRenderer::StencilSupport GrTessellatingPathRenderer::onGetStencilSupport(
- const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const {
- return GrPathRenderer::kNoSupport_StencilSupport;
-}
-
namespace {
// When the SkPathRef genID changes, invalidate a corresponding GrResource described by key.
diff --git a/src/gpu/GrTessellatingPathRenderer.h b/src/gpu/GrTessellatingPathRenderer.h
index aa7be77168..7598ceb065 100644
--- a/src/gpu/GrTessellatingPathRenderer.h
+++ b/src/gpu/GrTessellatingPathRenderer.h
@@ -21,10 +21,9 @@ public:
private:
bool onCanDrawPath(const CanDrawPathArgs& ) const override;
- StencilSupport onGetStencilSupport(const GrDrawTarget*,
- const GrPipelineBuilder*,
- const SkPath&,
- const GrStrokeInfo&) const override;
+ StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ return GrPathRenderer::kNoSupport_StencilSupport;
+ }
bool onDrawPath(const DrawPathArgs&) override;