move Skia setup code to a shared function

Change-Id: Ifcd434512854b5fedb0baf4ce1251a05f659b006
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137017
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
Luboš Luňák 2022-07-13 12:54:20 +02:00
parent 9eb42e3c36
commit 6c58b01c79

View file

@ -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();