[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - include/vcl vcl/opengl vcl/unx

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed Sep 2 09:25:47 PDT 2015


 include/vcl/salnativewidgets.hxx         |   13 +++++++++++++
 vcl/opengl/win/gdiimpl.cxx               |    2 +-
 vcl/opengl/x11/gdiimpl.cxx               |    2 +-
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |    5 ++++-
 4 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit bce6ef90b7e4ba4a9b49abb1afddd6ee07ea001e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Sep 2 22:47:50 2015 +0900

    tdf#93859 opengl - don't cache radiobuttons, refactor code dupl.
    
    Radio buttons and check boxes can't be cached with current
    framework as they have an additional rendering state provided in
    additional data.
    
    Refactor code to control which controls can be cached in one place
    only.
    
    Change-Id: I095a01cbf5dde013247d70ada89020f64c8c6510
    (cherry picked from commit 54962518fa2ca3860fcb4d2c772dea21b22a184e)
    Reviewed-on: https://gerrit.libreoffice.org/18271
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index 9692a80..fb128d3 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -279,6 +279,19 @@ public:
             && maSize.Width() == aOther.maSize.Width()
             && maSize.Height() == aOther.maSize.Height();
     }
+
+    bool canCacheControl()
+    {
+        switch(mnType)
+        {
+            case CTRL_CHECKBOX:
+            case CTRL_RADIOBUTTON:
+                return false;
+            default:
+                break;
+        }
+        return true;
+    }
 };
 
 struct ControlCacheHashFunction
diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx
index 0b53114..6896a02 100644
--- a/vcl/opengl/win/gdiimpl.cxx
+++ b/vcl/opengl/win/gdiimpl.cxx
@@ -119,7 +119,7 @@ bool WinOpenGLSalGraphicsImpl::RenderAndCacheNativeControl(OpenGLCompatibleDC& r
     if (!bResult)
         return false;
 
-    if (aControlCacheKey.mnType == CTRL_CHECKBOX)
+    if (!aControlCacheKey.canCacheControl())
         return true;
 
     ControlCachePair pair(aControlCacheKey, std::move(pCombo));
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 0663ce9..4c59284 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -235,7 +235,7 @@ bool X11OpenGLSalGraphicsImpl::RenderAndCacheNativeControl(X11Pixmap* pPixmap, X
     if (!bResult)
         return false;
 
-    if (aControlCacheKey.mnType == CTRL_CHECKBOX)
+    if (!aControlCacheKey.canCacheControl())
         return true;
 
     ControlCachePair pair(aControlCacheKey, std::move(pCombo));
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index d49f045..1220596 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -895,8 +895,11 @@ bool GtkSalGraphics::drawNativeControl(ControlType nType, ControlPart nPart,
                             Size( aCtrlRect.GetWidth()+2, aCtrlRect.GetHeight()+2) );
 
     ControlCacheKey aControlCacheKey(nType, nPart, nState, aPixmapRect.GetSize());
-    if (TryRenderCachedNativeControl(aControlCacheKey, aPixmapRect.Left(), aPixmapRect.Top()))
+    if (aControlCacheKey.canCacheControl()
+        && TryRenderCachedNativeControl(aControlCacheKey, aPixmapRect.Left(), aPixmapRect.Top()))
+    {
         return true;
+    }
 
     clipList aClip;
     int nPasses = 0;


More information about the Libreoffice-commits mailing list