summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToma┼ż Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-09-02 22:47:50 +0900
committerJan Holesovsky <kendy@collabora.com>2015-09-02 16:25:25 +0000
commitbce6ef90b7e4ba4a9b49abb1afddd6ee07ea001e (patch)
tree06fc78a40effdd7fa0d79bd4729b99d6b6af6897
parentdd6de340972b9a17517e27db9b5f598ab7d05bc5 (diff)
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@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--include/vcl/salnativewidgets.hxx13
-rw-r--r--vcl/opengl/win/gdiimpl.cxx2
-rw-r--r--vcl/opengl/x11/gdiimpl.cxx2
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx5
4 files changed, 19 insertions, 3 deletions
diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index 9692a80cbab8..fb128d380d4e 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 0b531141be17..6896a024ec7d 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 0663ce933d24..4c592842d9d8 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 d49f045204ad..122059656f89 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;