summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/opengl/FixedTextureAtlas.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/vcl/opengl/FixedTextureAtlas.cxx b/vcl/opengl/FixedTextureAtlas.cxx
index f6e400597342..8a3e927b4698 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();