diff options
Diffstat (limited to 'vcl/opengl/salbmp.cxx')
-rw-r--r-- | vcl/opengl/salbmp.cxx | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index 4c8261858023..abb9731b6d45 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -91,10 +91,6 @@ sal_uInt32 lclBytesPerRow(sal_uInt16 nBits, int nWidth) } return 0; } - -typedef std::vector<std::unique_ptr< FixedTextureAtlasManager > > TextureAtlasVector; -static vcl::DeleteOnDeinit< TextureAtlasVector > gTextureAtlases(new TextureAtlasVector); - } OpenGLSalBitmap::OpenGLSalBitmap() @@ -313,16 +309,18 @@ void lclInstantiateTexture(OpenGLTexture& rTexture, const int nWidth, const int { if (nWidth == nHeight) { - TextureAtlasVector &sTextureAtlases = *gTextureAtlases.get(); - if (sTextureAtlases.empty()) - { - sTextureAtlases.push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 16)); - sTextureAtlases.push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 24)); - sTextureAtlases.push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 32)); - sTextureAtlases.push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 48)); - sTextureAtlases.push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 64)); - } - for (std::unique_ptr<FixedTextureAtlasManager> & pTextureAtlas : sTextureAtlases) + typedef std::vector<std::unique_ptr<FixedTextureAtlasManager>> TextureAtlasVector; + static vcl::DeleteOnDeinit<TextureAtlasVector> aTextureAtlases([]() { + TextureAtlasVector* p = new TextureAtlasVector; + p->reserve(5); + p->push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 16)); + p->push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 24)); + p->push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 32)); + p->push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 48)); + p->push_back(std::make_unique<FixedTextureAtlasManager>(8, 8, 64)); + return p; + }()); + for (std::unique_ptr<FixedTextureAtlasManager>& pTextureAtlas : *aTextureAtlases.get()) { if (nWidth == pTextureAtlas->GetSubtextureSize()) { |