Kaydet (Commit) a6dc9f3f authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

Add interface for software-only bitmap rendering

When SAL_USE_VCLPLUGIN=svp is used, LO is expected to render
output only to bitmaps, without real GUI windows. This adds an
enabler and a getter function to the Application class, so one
can query this information easy as (Enable|Is)BitmapRendering.

This can be used by all VCL plugins, which can't fall back to
the Cairo based SVP plugin, primary OSX and Win.

A working implementation should allow to run all test via SSH.
All window-requiring tests already have to set this requirement
using gb_CppunitTest_use_vcl_non_headless(_with_windows)? and
should be moved to a different make target, or we need some test
harness to handle this correctly, before VCL fails the test.

Change-Id: I4bd4c81122a6686b090fdd93256d4712ac5f05dd
Reviewed-on: https://gerrit.libreoffice.org/64051
Tested-by: Jenkins
Reviewed-by: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
üst 329db5d4
...@@ -1218,19 +1218,19 @@ public: ...@@ -1218,19 +1218,19 @@ public:
/** Enable Console Only mode /** Enable Console Only mode
Used to disable Mac specific app init that requires an app bundle. Convenience function to enable headless and bitmap rendering.
*/ */
static void EnableConsoleOnly(); static void EnableConsoleOnly();
/** Determines if console only mode is enabled. /** Enable software-only bitmap rendering
*/
Used to see if Mac specific app init has been disabled. static void EnableBitmapRendering();
@returns True if console only mode is on, false if not. /** Determines if bitmap rendering is enabled
@see EnableConsoleOnly @return True if bitmap rendering is enabled.
*/ */
static bool IsConsoleOnly(); static bool IsBitmapRendering();
///@} ///@}
......
...@@ -154,6 +154,7 @@ struct ImplSVAppData ...@@ -154,6 +154,7 @@ struct ImplSVAppData
bool mbAppQuit = false; // is Application::Quit() called bool mbAppQuit = false; // is Application::Quit() called
bool mbSettingsInit = false; // true: Settings are initialized bool mbSettingsInit = false; // true: Settings are initialized
DialogCancelMode meDialogCancel = DialogCancelMode::Off; // true: All Dialog::Execute() calls will be terminated immediately with return false DialogCancelMode meDialogCancel = DialogCancelMode::Off; // true: All Dialog::Execute() calls will be terminated immediately with return false
bool mbRenderToBitmaps = false; // set via svp / headless plugin
/** Controls whether showing any IME status window is toggled on or off. /** Controls whether showing any IME status window is toggled on or off.
......
...@@ -243,6 +243,13 @@ SalInstance *CreateSalInstance() ...@@ -243,6 +243,13 @@ SalInstance *CreateSalInstance()
#endif #endif
rtl::Bootstrap::get( "SAL_USE_VCLPLUGIN", aUsePlugin ); rtl::Bootstrap::get( "SAL_USE_VCLPLUGIN", aUsePlugin );
if (aUsePlugin == "svp")
{
Application::EnableBitmapRendering();
#ifndef HEADLESS_VCLPLUG
aUsePlugin.clear();
#endif
}
if( !aUsePlugin.isEmpty() ) if( !aUsePlugin.isEmpty() )
pInst = tryInstance( aUsePlugin, true ); pInst = tryInstance( aUsePlugin, true );
......
...@@ -1438,6 +1438,7 @@ const LocaleDataWrapper& Application::GetAppLocaleDataWrapper() ...@@ -1438,6 +1438,7 @@ const LocaleDataWrapper& Application::GetAppLocaleDataWrapper()
void Application::EnableHeadlessMode( bool dialogsAreFatal ) void Application::EnableHeadlessMode( bool dialogsAreFatal )
{ {
assert(GetDialogCancelMode() == DialogCancelMode::Off);
SetDialogCancelMode( SetDialogCancelMode(
dialogsAreFatal ? DialogCancelMode::Fatal : DialogCancelMode::Silent ); dialogsAreFatal ? DialogCancelMode::Fatal : DialogCancelMode::Silent );
} }
...@@ -1447,17 +1448,20 @@ bool Application::IsHeadlessModeEnabled() ...@@ -1447,17 +1448,20 @@ bool Application::IsHeadlessModeEnabled()
return IsDialogCancelEnabled() || comphelper::LibreOfficeKit::isActive(); return IsDialogCancelEnabled() || comphelper::LibreOfficeKit::isActive();
} }
static bool bConsoleOnly = false; void Application::EnableBitmapRendering()
{
ImplGetSVData()->maAppData.mbRenderToBitmaps = true;
}
bool Application::IsConsoleOnly() bool Application::IsBitmapRendering()
{ {
return bConsoleOnly; return ImplGetSVData()->maAppData.mbRenderToBitmaps;
} }
void Application::EnableConsoleOnly() void Application::EnableConsoleOnly()
{ {
EnableHeadlessMode(true); EnableHeadlessMode(true);
bConsoleOnly = true; EnableBitmapRendering();
} }
static bool bEventTestingMode = false; static bool bEventTestingMode = false;
......
...@@ -956,8 +956,8 @@ bool OpenGLHelper::isVCLOpenGLEnabled() ...@@ -956,8 +956,8 @@ bool OpenGLHelper::isVCLOpenGLEnabled()
static bool bEnable = false; static bool bEnable = false;
static bool bForceOpenGL = false; static bool bForceOpenGL = false;
// If we are a console app, then we don't use OpenGL // No hardware rendering, so no OpenGL
if ( Application::IsConsoleOnly() ) if (Application::IsBitmapRendering())
return false; return false;
//tdf#106155, disable GL while loading certain bitmaps needed for the initial toplevel windows //tdf#106155, disable GL while loading certain bitmaps needed for the initial toplevel windows
...@@ -988,19 +988,14 @@ bool OpenGLHelper::isVCLOpenGLEnabled() ...@@ -988,19 +988,14 @@ bool OpenGLHelper::isVCLOpenGLEnabled()
else if (bSupportsVCLOpenGL) else if (bSupportsVCLOpenGL)
{ {
static bool bEnableGLEnv = !!getenv("SAL_ENABLEGL"); static bool bEnableGLEnv = !!getenv("SAL_ENABLEGL");
static bool bHeadlessPlugin = []{
OUString plugin;
rtl::Bootstrap::get("SAL_USE_VCLPLUGIN", plugin);
return plugin == "svp";
}();
bEnable = bEnableGLEnv; bEnable = bEnableGLEnv;
if (officecfg::Office::Common::VCL::UseOpenGL::get()) if (officecfg::Office::Common::VCL::UseOpenGL::get())
bEnable = true; bEnable = true;
// Force disable in safe mode or when running with headless plugin // Force disable in safe mode
if (bHeadlessPlugin || Application::IsSafeModeEnabled()) if (Application::IsSafeModeEnabled())
bEnable = false; bEnable = false;
bRet = bEnable; bRet = bEnable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment