summaryrefslogtreecommitdiff
path: root/vcl/opengl
diff options
context:
space:
mode:
authorIan Barkley-Yeung <ibarkleyyeung@gmail.com>2020-05-09 21:28:44 -0700
committerLuboš Luňák <l.lunak@collabora.com>2020-05-11 14:42:12 +0200
commit4ee314959a377031a382b6ba42c6b5d5a0c0a367 (patch)
treec57b010ab44eb542ec5bd6d00a6f079fe455efe0 /vcl/opengl
parent4855b5771f35ef354fbb5fb00a8cf690d5427c69 (diff)
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.lunak@collabora.com>
Diffstat (limited to 'vcl/opengl')
-rw-r--r--vcl/opengl/salbmp.cxx26
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())
{