cui/source/options/optgdlg.cxx |   47 ++++++++++++++++++++++-------------------
 cui/source/options/optgdlg.hxx |    1 
 2 files changed, 27 insertions(+), 21 deletions(-)

New commits:
commit abea897baeca5682cdad79a7c9703940afc0b39c
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Nov 24 12:41:08 2020 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed Nov 25 15:50:15 2020 +0100

    clean up enabling/disabling GUI options related to Skia
    
    This should properly enable/disable 'force Skia software rendering'
    and 'use hardware acceleration' checkboxes when Skia is enabled or
    disabled.
    Technically the two options are duplicates, since 'use hardware
    acceleration' is the exact opposite of 'force Skia software
    rendering'. But the implementation of the hw accel option is so tied
    to the implementation of the canvas module that it's simpler
    to ignore it for Skia.
    
    Change-Id: Ia7c54140aec72d6ef75b7ba53ce83037311f0caf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106491
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>
    (cherry picked from commit feafba7cc94247f45a82ee4f82f1b0a5f2f61656)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106525

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 6b71b125e078..0dc33f2c64ba 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -551,11 +551,6 @@ CanvasSettings::CanvasSettings() :
 
 bool CanvasSettings::IsHardwareAccelerationAvailable() const
 {
-    if (SkiaHelper::isVCLSkiaEnabled() && Application::GetToolkitName() != 
"gtk3")
-    {
-        mbHWAccelAvailable = false;
-        return false;
-    }
 #if HAVE_FEATURE_OPENGL
     if (OpenGLWrapper::isVCLOpenGLEnabled() && Application::GetToolkitName() 
!= "gtk3")
     {
@@ -716,8 +711,6 @@ OfaViewTabPage::OfaViewTabPage(weld::Container* pPage, 
weld::DialogController* p
 
     m_xMoreIcons->set_from_icon_name("cmd/sc_additionsdialog.png");
     m_xMoreIcons->connect_clicked(LINK(this, OfaViewTabPage, 
OnMoreIconsClick));
-
-    UpdateSkiaStatus();
 }
 
 OfaViewTabPage::~OfaViewTabPage()
@@ -779,6 +772,10 @@ void OfaViewTabPage::UpdateSkiaStatus()
     // FIXME: should really add code to show a 'lock' icon here.
     
m_xUseSkia->set_sensitive(!officecfg::Office::Common::VCL::UseSkia::isReadOnly());
     m_xForceSkiaRaster->set_sensitive(m_xUseSkia->get_active() && 
!officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly());
+
+    // Technically the 'use hardware acceleration' option could be used to 
mean !forceSkiaRaster, but the implementation
+    // of the option is so tied to the implementation of the canvas module 
that it's simpler to ignore it.
+    UpdateHardwareAccelStatus();
 #else
     HideSkiaWidgets();
 #endif
@@ -1058,20 +1055,8 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
     m_xContextMenuShortcutsLB->set_active(bContextMenuShortcutsNonDefault ? 
eContextMenuShortcuts + 1 : 0);
     m_xContextMenuShortcutsLB->save_value();
 
-    { // #i95644# HW accel (unified to disable mechanism)
-        if(pCanvasSettings->IsHardwareAccelerationAvailable())
-        {
-            
m_xUseHardwareAccell->set_active(pCanvasSettings->IsHardwareAccelerationEnabled());
-            
m_xUseHardwareAccell->set_sensitive(!pCanvasSettings->IsHardwareAccelerationRO());
-        }
-        else
-        {
-            m_xUseHardwareAccell->set_active(false);
-            m_xUseHardwareAccell->set_sensitive(false);
-        }
-
-        m_xUseHardwareAccell->save_state();
-    }
+    UpdateHardwareAccelStatus();
+    m_xUseHardwareAccell->save_state();
 
     { // #i95644# AntiAliasing
         if(mpDrawinglayerOpt->IsAAPossibleOnThisSystem())
@@ -1086,6 +1071,7 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
 
         m_xUseAntiAliase->save_state();
     }
+
     m_xUseSkia->set_active(mpSkiaConfig->useSkia());
     m_xForceSkiaRaster->set_active(mpSkiaConfig->forceSkiaRaster());
 
@@ -1097,6 +1083,25 @@ void OfaViewTabPage::Reset( const SfxItemSet* )
     m_xForceSkiaRaster->save_state();
 
     OnAntialiasingToggled(*m_xFontAntiAliasing);
+    UpdateSkiaStatus();
+}
+
+void OfaViewTabPage::UpdateHardwareAccelStatus()
+{
+    // #i95644# HW accel (unified to disable mechanism)
+    if(pCanvasSettings->IsHardwareAccelerationAvailable())
+    {
+        
m_xUseHardwareAccell->set_active(pCanvasSettings->IsHardwareAccelerationEnabled());
+        
m_xUseHardwareAccell->set_sensitive(!pCanvasSettings->IsHardwareAccelerationRO());
+    }
+    else
+    {
+        m_xUseHardwareAccell->set_active(false);
+        m_xUseHardwareAccell->set_sensitive(false);
+    }
+#if HAVE_FEATURE_SKIA
+    m_xUseHardwareAccell->set_sensitive(!m_xUseSkia->get_active());
+#endif
 }
 
 struct LanguageConfig_Impl
diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx
index 93dc5280b98e..0944bb674932 100644
--- a/cui/source/options/optgdlg.hxx
+++ b/cui/source/options/optgdlg.hxx
@@ -125,6 +125,7 @@ private:
     DECL_STATIC_LINK(OfaViewTabPage, OnMoreIconsClick, weld::Button&, void);
     void UpdateSkiaStatus();
     void HideSkiaWidgets();
+    void UpdateHardwareAccelStatus();
 
 public:
     OfaViewTabPage(weld::Container* pPage, weld::DialogController* 
pController, const SfxItemSet& rSet);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to