vcl/opengl/FixedTextureAtlas.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
New commits: commit 50902f4d3bca92aefe0a3b663c3d175b60ecb25f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Fri Sep 11 12:27:45 2015 +0200 opengl: optimize search for a free slot in texture atlas Change-Id: Ic853457871b914f9c1beb2f648bf7d9d18dce957 (cherry picked from commit 4823b6d4e989943c31e20027564ab4eca43f6f8d) Reviewed-on: https://gerrit.libreoffice.org/18624 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> diff --git a/vcl/opengl/FixedTextureAtlas.cxx b/vcl/opengl/FixedTextureAtlas.cxx index c8ca508..7a9b54e 100644 --- a/vcl/opengl/FixedTextureAtlas.cxx +++ b/vcl/opengl/FixedTextureAtlas.cxx @@ -36,15 +36,18 @@ OpenGLTexture FixedTextureAtlasManager::InsertBuffer(int nWidth, int nHeight, in { ImplOpenGLTexture* pTexture = nullptr; - for (size_t i = 0; i < mpTextures.size(); i++) + auto funFreeSlot = [] (std::unique_ptr<ImplOpenGLTexture>& mpTexture) { - if (mpTextures[i]->mnFreeSlots > 0) - { - pTexture = mpTextures[i].get(); - } - } + return mpTexture->mnFreeSlots > 0; + }; + + auto aIterator = std::find_if(mpTextures.begin(), mpTextures.end(), funFreeSlot); - if (!pTexture) + if (aIterator != mpTextures.end()) + { + pTexture = (*aIterator).get(); + } + else { CreateNewTexture(); pTexture = mpTextures.back().get();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits