[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/opengl
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Fri Aug 7 02:34:32 PDT 2015
vcl/opengl/x11/gdiimpl.cxx | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
New commits:
commit 7152aa8cba6ec58c4b234cd0024a5b1a980e0b04
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jul 24 14:19:35 2015 +0900
Use LRU map for caching of native widgets
Change-Id: Ia0423dac5309aabc5e81357cf4f67b5ee14bab31
(cherry picked from commit 3bc00eca4acf9dfc3b2834077cee552f32c8f107)
Reviewed-on: https://gerrit.libreoffice.org/17556
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 3890b64..2114419 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -25,6 +25,8 @@
#include <vcl/opengl/OpenGLContext.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
+#include <o3tl/lru_map.hxx>
+
X11OpenGLSalGraphicsImpl::X11OpenGLSalGraphicsImpl( X11SalGraphics& rParent ):
OpenGLSalGraphicsImpl(rParent,rParent.GetGeometryProvider()),
mrParent(rParent)
@@ -117,9 +119,10 @@ struct TextureCombo
std::unique_ptr<OpenGLTexture> mpMask;
};
-typedef std::unordered_map<ControlCacheKey, std::unique_ptr<TextureCombo>, ControlCacheHashFunction> ControlCacheType;
+typedef typename std::pair<ControlCacheKey, std::unique_ptr<TextureCombo>> ControlCachePair;
+typedef o3tl::lru_map<ControlCacheKey, std::unique_ptr<TextureCombo>, ControlCacheHashFunction> ControlCacheType;
-ControlCacheType gTextureCache;
+ControlCacheType gTextureCache(200);
bool X11OpenGLSalGraphicsImpl::RenderPixmap(X11Pixmap* pPixmap, X11Pixmap* pMask, int nX, int nY, TextureCombo& rCombo)
{
@@ -235,7 +238,8 @@ bool X11OpenGLSalGraphicsImpl::RenderAndCacheNativeControl(X11Pixmap* pPixmap, X
{
std::unique_ptr<TextureCombo> pCombo(new TextureCombo);
bool bResult = RenderPixmap(pPixmap, pMask, nX, nY, *pCombo);
- gTextureCache[aControlCacheKey] = std::move(pCombo);
+ ControlCachePair pair(aControlCacheKey, std::move(pCombo));
+ gTextureCache.insert(std::move(pair));
return bResult;
}
More information about the Libreoffice-commits
mailing list