Kaydet (Commit) 50902f4d authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Michael Meeks

opengl: optimize search for a free slot in texture atlas

Change-Id: Ic853457871b914f9c1beb2f648bf7d9d18dce957
(cherry picked from commit 4823b6d4)
Reviewed-on: https://gerrit.libreoffice.org/18624Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst 4833f5a9
...@@ -36,15 +36,18 @@ OpenGLTexture FixedTextureAtlasManager::InsertBuffer(int nWidth, int nHeight, in ...@@ -36,15 +36,18 @@ OpenGLTexture FixedTextureAtlasManager::InsertBuffer(int nWidth, int nHeight, in
{ {
ImplOpenGLTexture* pTexture = nullptr; ImplOpenGLTexture* pTexture = nullptr;
for (size_t i = 0; i < mpTextures.size(); i++) auto funFreeSlot = [] (std::unique_ptr<ImplOpenGLTexture>& mpTexture)
{ {
if (mpTextures[i]->mnFreeSlots > 0) return mpTexture->mnFreeSlots > 0;
{ };
pTexture = mpTextures[i].get();
} auto aIterator = std::find_if(mpTextures.begin(), mpTextures.end(), funFreeSlot);
}
if (!pTexture) if (aIterator != mpTextures.end())
{
pTexture = (*aIterator).get();
}
else
{ {
CreateNewTexture(); CreateNewTexture();
pTexture = mpTextures.back().get(); pTexture = mpTextures.back().get();
......
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