Avoid rerunning path renderer chain when path known to require sw

Change-Id: If8bdeadf95543917a6e00570b5806a3ee23aa335
Reviewed-on: https://skia-review.googlesource.com/126508
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Brian Salomon 2018-05-07 14:44:57 -04:00 committed by Skia Commit-Bot
parent 6198f39adc
commit e7df0bb900
3 changed files with 18 additions and 9 deletions

View File

@ -466,19 +466,24 @@ GrPathRenderer* GrDrawingManager::getPathRenderer(const GrPathRenderer::CanDrawP
GrPathRenderer* pr = fPathRendererChain->getPathRenderer(args, drawType, stencilSupport);
if (!pr && allowSW) {
if (!fSoftwarePathRenderer) {
fSoftwarePathRenderer =
new GrSoftwarePathRenderer(fContext->contextPriv().proxyProvider(),
fOptionsForPathRendererChain.fAllowPathMaskCaching);
}
if (GrPathRenderer::CanDrawPath::kNo != fSoftwarePathRenderer->canDrawPath(args)) {
pr = fSoftwarePathRenderer;
auto swPR = this->getSoftwarePathRenderer();
if (GrPathRenderer::CanDrawPath::kNo != swPR->canDrawPath(args)) {
pr = swPR;
}
}
return pr;
}
GrPathRenderer* GrDrawingManager::getSoftwarePathRenderer() {
if (!fSoftwarePathRenderer) {
fSoftwarePathRenderer =
new GrSoftwarePathRenderer(fContext->contextPriv().proxyProvider(),
fOptionsForPathRendererChain.fAllowPathMaskCaching);
}
return fSoftwarePathRenderer;
}
GrCoverageCountingPathRenderer* GrDrawingManager::getCoverageCountingPathRenderer() {
if (!fPathRendererChain) {
fPathRendererChain = new GrPathRendererChain(fContext, fOptionsForPathRendererChain);

View File

@ -59,6 +59,8 @@ public:
GrPathRendererChain::DrawType drawType,
GrPathRenderer::StencilSupport* stencilSupport = nullptr);
GrPathRenderer* getSoftwarePathRenderer();
// Returns a direct pointer to the coverage counting path renderer, or null if it is not
// supported and turned on.
GrCoverageCountingPathRenderer* getCoverageCountingPathRenderer();

View File

@ -1662,9 +1662,11 @@ void GrRenderTargetContext::drawShapeUsingPathRenderer(const GrClip& clip,
return;
}
canDrawArgs.fShape = &tempShape;
// This time, allow SW renderer
pr = this->drawingManager()->getPathRenderer(canDrawArgs, true, kType);
} else {
pr = this->drawingManager()->getSoftwarePathRenderer();
}
// This time, allow SW renderer
pr = this->drawingManager()->getPathRenderer(canDrawArgs, true, kType);
}
if (!pr) {