diff options
author | Chris Dalton <csmartdalton@google.com> | 2017-09-04 01:47:11 -0600 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-07 17:04:51 +0000 |
commit | 60f42494f5d45c38e260ce089cdddfb600f799b2 (patch) | |
tree | f7c6235077d40c2cee2b703eb37cbe48b8350493 /src/gpu/GrPathRendererChain.cpp | |
parent | 2bbdcc44c63974f29f3743bb58d929601a3f65c6 (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: 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>
Diffstat (limited to 'src/gpu/GrPathRendererChain.cpp')
-rw-r--r-- | src/gpu/GrPathRendererChain.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp index 354d086a22..4a39f256fe 100644 --- a/src/gpu/GrPathRendererChain.cpp +++ b/src/gpu/GrPathRendererChain.cpp @@ -96,18 +96,29 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer( } } - for (int i = 0; i < fChain.count(); ++i) { - if (fChain[i]->canDrawPath(args)) { - if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) { - GrPathRenderer::StencilSupport support = fChain[i]->getStencilSupport(*args.fShape); - if (support < minStencilSupport) { - continue; - } else if (stencilSupport) { - *stencilSupport = support; - } + GrPathRenderer* bestPathRenderer = nullptr; + for (const sk_sp<GrPathRenderer>& pr : fChain) { + GrPathRenderer::StencilSupport support = GrPathRenderer::kNoSupport_StencilSupport; + if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) { + support = pr->getStencilSupport(*args.fShape); + if (support < minStencilSupport) { + continue; } - return fChain[i].get(); + } + GrPathRenderer::CanDrawPath canDrawPath = pr->canDrawPath(args); + if (GrPathRenderer::CanDrawPath::kNo == canDrawPath) { + continue; + } + if (GrPathRenderer::CanDrawPath::kAsBackup == canDrawPath && bestPathRenderer) { + continue; + } + if (stencilSupport) { + *stencilSupport = support; + } + bestPathRenderer = pr.get(); + if (GrPathRenderer::CanDrawPath::kYes == canDrawPath) { + break; } } - return nullptr; + return bestPathRenderer; } |