diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-07-24 14:19:35 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-07-24 19:15:01 +0900 |
commit | 3bc00eca4acf9dfc3b2834077cee552f32c8f107 (patch) | |
tree | ae61c3e43a57a20dc4b29e37eb06fa7ad6182d84 /vcl | |
parent | 80a92134806a876287818530eb61c6bb536a05f9 (diff) |
Use LRU map for caching of native widgets
Change-Id: Ia0423dac5309aabc5e81357cf4f67b5ee14bab31
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/opengl/x11/gdiimpl.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index 3890b6443de3..211441931c00 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; } |