diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-10-12 17:46:11 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-11-27 09:55:05 +0100 |
commit | 1e9fae677579b59ddbc4cd69e201b95f51b8c742 (patch) | |
tree | 3bcbc86dae348397d10f0557bbceca88a0b86469 /vcl/skia/SkiaHelper.cxx | |
parent | 534d89fed30983bcc48387facc3410f13e230683 (diff) |
initial empty Skia VCL implementation
This mostly duplicates OpenGL cases. Pretty much all implementation
methods are empty.
Change-Id: I333506f56dcc46c3e9405fe8194c172de17c54fd
Diffstat (limited to 'vcl/skia/SkiaHelper.cxx')
-rw-r--r-- | vcl/skia/SkiaHelper.cxx | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx new file mode 100644 index 000000000000..1d2cf20d9c0b --- /dev/null +++ b/vcl/skia/SkiaHelper.cxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <vcl/skia/SkiaHelper.hxx> + +#include <vcl/svapp.hxx> + +bool SkiaHelper::isVCLSkiaEnabled() +{ + /** + * The !bSet part should only be called once! Changing the results in the same + * run will mix Skia and normal rendering. + */ + + static bool bSet = false; + static bool bEnable = false; + static bool bForceSkia = false; + + // No hardware rendering, so no Skia + // TODO SKIA + if (Application::IsBitmapRendering()) + return false; + + if (bSet) + { + return bForceSkia || bEnable; + } + + /* + * There are a number of cases that these environment variables cover: + * * SAL_FORCESKIA forces Skia independent of any other option + * * SAL_DISABLESKIA avoids the use of Skia if SAL_FORCESKIA is not set + */ + + bSet = true; + bForceSkia = !!getenv( + "SAL_FORCESKIA"); // TODO SKIA || officecfg::Office::Common::VCL::ForceOpenGL::get(); + + bool bRet = false; + bool bSupportsVCLSkia = true; // TODO SKIA supportsVCLOpenGL(); + // TODO SKIA always call supportsVCLOpenGL to de-zombie the glxtest child process on X11 + if (bForceSkia) + { + bRet = true; + } + else if (bSupportsVCLSkia) + { + static bool bEnableSkiaEnv = !!getenv("SAL_ENABLESKIA"); + + bEnable = bEnableSkiaEnv; + + // TODO SKIA if (officecfg::Office::Common::VCL::UseOpenGL::get()) + + // Force disable in safe mode + if (Application::IsSafeModeEnabled()) + bEnable = false; + + bRet = bEnable; + } + + // TODO SKIA CrashReporter::AddKeyValue("UseOpenGL", OUString::boolean(bRet)); + + return bRet; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |