From cc6941e8ce4a22cd7bdcdf1db72da02546b35fd2 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Mon, 5 Oct 2020 20:42:49 +0200 Subject: better way of ensuring Skia is used only with canvas that work Most canvas implementations fall flat on their face when used with Skia for various reasons, such as assuming presence of cairo canvas or GDI bitmaps. I kind of already blocked them in b4c28826e0f8716583e7663ca2ea7a2, when I just copy&pasted the OpenGL case. That just selects the last implementation, which in reality appears to be always vclcanvas, which is probably just luck. Also this wouldn't work with more than one possible canvas implementation for Skia. Change-Id: If644abbaeed72f1a649f8974d00f564131aa9329 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103784 Reviewed-by: Thorsten Behrens Tested-by: Jenkins --- canvas/source/factory/cf_service.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'canvas') diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index 874b1ffe68bf..9bb75d5e26b0 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -304,8 +304,6 @@ Reference CanvasFactory::lookupAndUse( if( OpenGLWrapper::isVCLOpenGLEnabled() ) bForceLastEntry = true; #endif - if( SkiaHelper::isVCLSkiaEnabled() ) - bForceLastEntry = true; // use anti-aliasing canvas, if config flag set (or not existing) bool bUseAAEntry(true); @@ -379,10 +377,14 @@ Reference CanvasFactory::lookupAndUse( if (bForceLastEntry && pCurrImpl != pEndImpl) pCurrImpl = pEndImpl-1; - while( pCurrImpl != pEndImpl ) + for(; pCurrImpl != pEndImpl; ++pCurrImpl) { const OUString aCurrName(pCurrImpl->trim()); + // Skia works only with vclcanvas. + if( SkiaHelper::isVCLSkiaEnabled() && !aCurrName.endsWith(".VCL")) + continue; + // check whether given canvas service is listed in the // sequence of "accelerated canvas implementations" const bool bIsAcceleratedImpl( @@ -426,8 +428,6 @@ Reference CanvasFactory::lookupAndUse( return xCanvas; } } - - ++pCurrImpl; } return Reference(); -- cgit