Kaydet (Commit) d2dbd3c7 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Andras Timar

Use LRU map for caching of native widgets

Change-Id: Ia0423dac5309aabc5e81357cf4f67b5ee14bab31
(cherry picked from commit 3bc00eca)
Reviewed-on: https://gerrit.libreoffice.org/17556Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst d155b583
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment