aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ccpr
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-09-08 16:25:08 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-12 20:04:20 +0000
commitdb91c6e7fbfc9d1d8fd203f7e08eefb602e4a0b9 (patch)
treecb13d0253d2161a7e995bc94fc8cedb85df7dd04 /src/gpu/ccpr
parenta640c49b7ecf667696542143edec96d10a940592 (diff)
Improve heuristics for when to use ccpr
Gives the convex and tessellating renderers first claim on larger paths, and the distance field renderer first claim on complex, non-volatile paths. This also requires plumbing the clip bounds through GrPathRenderer::CanDrawPathArgs. Bug: skia: Change-Id: I16e1d35ad5ee63251e33f113b1579cbba60456da Reviewed-on: https://skia-review.googlesource.com/42224 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/ccpr')
-rw-r--r--src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
index 4aff0a918c..0e6198951e 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
@@ -54,6 +54,27 @@ GrCoverageCountingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const
return CanDrawPath::kNo;
}
+ SkRect devBounds;
+ SkIRect devIBounds;
+ args.fViewMatrix->mapRect(&devBounds, path.getBounds());
+ devBounds.roundOut(&devIBounds);
+ if (!devIBounds.intersect(*args.fClipConservativeBounds)) {
+ // Path is completely clipped away. Our code will eventually notice this before doing any
+ // real work.
+ return CanDrawPath::kYes;
+ }
+
+ if (devIBounds.height() * devIBounds.width() > 256 * 256) {
+ // Large paths can blow up the atlas fast. And they are not ideal for a two-pass rendering
+ // algorithm. Give the simpler direct renderers a chance before we commit to drawing it.
+ return CanDrawPath::kAsBackup;
+ }
+
+ if (args.fShape->hasUnstyledKey() && path.countVerbs() > 50) {
+ // Complex paths do better cached in an SDF, if the renderer will accept them.
+ return CanDrawPath::kAsBackup;
+ }
+
return CanDrawPath::kYes;
}