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: I45aac5462ca1bc0bc839eb1c315db9493901a07e
Reviewed-on: https://skia-review.googlesource.com/42222
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index ef19367..b80a811 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -682,15 +682,18 @@
return true;
}
-bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
+GrPathRenderer::CanDrawPath GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
// If we aren't a single_pass_shape, we require stencil buffers.
if (!single_pass_shape(*args.fShape) && args.fCaps->avoidStencilBuffers()) {
- return false;
+ return CanDrawPath::kNo;
}
// This path renderer only fills and relies on MSAA for antialiasing. Stroked shapes are
// handled by passing on the original shape and letting the caller compute the stroked shape
// which will have a fill style.
- return args.fShape->style().isSimpleFill() && (GrAAType::kCoverage != args.fAAType);
+ if (!args.fShape->style().isSimpleFill() || GrAAType::kCoverage == args.fAAType) {
+ return CanDrawPath::kNo;
+ }
+ return CanDrawPath::kYes;
}
bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {