[Libreoffice-commits] core.git: vcl/opengl
Ian Barkley-Yeung (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 11 12:42:46 UTC 2020
vcl/opengl/salbmp.cxx | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
New commits:
commit 4ee314959a377031a382b6ba42c6b5d5a0c0a367
Author: Ian Barkley-Yeung <ibarkleyyeung at gmail.com>
AuthorDate: Sat May 9 21:28:44 2020 -0700
Commit: Luboš Luňák <l.lunak at 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.lunak at 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())
{
More information about the Libreoffice-commits
mailing list