vcl/opengl/salbmp.cxx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
New commits: commit 4ee314959a377031a382b6ba42c6b5d5a0c0a367 Author: Ian Barkley-Yeung <ibarkleyye...@gmail.com> AuthorDate: Sat May 9 21:28:44 2020 -0700 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Mon May 11 14:42:12 2020 +0200 tdf#38835: strip out non-trivial globals before main Allocate the fixed texture vector on first use instead of before main. This should make startup very, very slightly faster. Tested by just starting up a writer document. Let me know if there are other tests I should be doing. Change-Id: Iaf752327b86c131a0241786485b30030a4f987c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93939 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> 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()) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits