From 6c58b01c791ec4939523147d5d075611bbbfe314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 13 Jul 2022 12:54:20 +0200 Subject: [PATCH] move Skia setup code to a shared function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifcd434512854b5fedb0baf4ce1251a05f659b006 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137017 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- vcl/skia/SkiaHelper.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx index 84c40baffae4..f4346b74f73a 100644 --- a/vcl/skia/SkiaHelper.cxx +++ b/vcl/skia/SkiaHelper.cxx @@ -273,6 +273,8 @@ static bool supportsVCLSkia() return getenv("SAL_DISABLESKIA") == nullptr; } +static void initInternal(); + bool isVCLSkiaEnabled() { /** @@ -308,8 +310,7 @@ bool isVCLSkiaEnabled() if (bForceSkia && bSupportsVCLSkia) { bRet = true; - SkGraphics::Init(); - SkLoOpts::Init(); + initInternal(); // don't actually block if denylisted, but log it if enabled, and also get the vendor id checkDeviceDenylisted(true); } @@ -334,8 +335,7 @@ bool isVCLSkiaEnabled() if (bEnable) { - SkGraphics::Init(); - SkLoOpts::Init(); + initInternal(); checkDeviceDenylisted(); // switch to raster if driver is denylisted } @@ -754,6 +754,13 @@ void setBlenderXor(SkPaint* paint) paint->setBlender(xorBlender); } +static void initInternal() +{ + // Set up all things needed for using Skia. + SkGraphics::Init(); + SkLoOpts::Init(); +} + void cleanup() { sharedWindowContext.reset();