aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathRenderer.h
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-09-07 13:22:46 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-07 22:18:53 +0000
commit5ed4423090e63e4c7888d6dd44fde177adea13f3 (patch)
tree83a3f92bc0630a8777d08bd9da1a097c82943b14 /src/gpu/GrPathRenderer.h
parent2199e0bc7cbd2c834a93ab2cc83ee1bfdd79a0ed (diff)
Improve GrPathRendererChain heuristics
Changes GrPathRenderer::canDrawPath to return a 'CanDrawPath' enum, which contains a new kAsBackup value that means "I'm better than SW, but give the path renderers below me a chance first." Bug: skia: Change-Id: Ia339567800a3127e61b9beaed19504cd504f18af Reviewed-on: https://skia-review.googlesource.com/43761 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/GrPathRenderer.h')
-rw-r--r--src/gpu/GrPathRenderer.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index a3cf8c6151..cf0ef6effc 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -67,6 +67,12 @@ public:
return this->onGetStencilSupport(shape);
}
+ enum class CanDrawPath {
+ kNo,
+ kAsBackup, // i.e. This renderer is better than SW fallback if no others can draw the path.
+ kYes
+ };
+
/** Args to canDrawPath()
*
* fCaps The context caps
@@ -94,13 +100,11 @@ public:
};
/**
- * Returns true if this path renderer is able to render the path. Returning false allows the
- * caller to fallback to another path renderer This function is called when searching for a path
- * renderer capable of rendering a path.
- *
- * @return true if the path can be drawn by this object, false otherwise.
+ * Returns how well this path renderer is able to render the given path. Returning kNo or
+ * kAsBackup allows the caller to keep searching for a better path renderer. This function is
+ * called when searching for the best path renderer to draw a path.
*/
- bool canDrawPath(const CanDrawPathArgs& args) const {
+ CanDrawPath canDrawPath(const CanDrawPathArgs& args) const {
SkDEBUGCODE(args.validate();)
return this->onCanDrawPath(args);
}
@@ -158,7 +162,7 @@ public:
GrFSAAType::kUnifiedMSAA != args.fRenderTargetContext->fsaaType()));
SkASSERT(!(canArgs.fAAType == GrAAType::kMixedSamples &&
GrFSAAType::kMixedSamples != args.fRenderTargetContext->fsaaType()));
- SkASSERT(this->canDrawPath(canArgs));
+ SkASSERT(CanDrawPath::kNo != this->canDrawPath(canArgs));
if (!args.fUserStencilSettings->isUnused()) {
SkPath path;
args.fShape->asPath(&path);
@@ -253,7 +257,7 @@ private:
/**
* Subclass implementation of canDrawPath()
*/
- virtual bool onCanDrawPath(const CanDrawPathArgs& args) const = 0;
+ virtual CanDrawPath onCanDrawPath(const CanDrawPathArgs& args) const = 0;
/**
* Subclass implementation of stencilPath(). Subclass must override iff it ever returns