From aec32b6de89cfdd3864ee52622c2209a74340956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 22 Sep 2023 22:47:03 +0200 Subject: [PATCH] MagnumFont: use in-place Containers::Pointer construction. No naked new, PLEASE, it's 2023. --- src/MagnumPlugins/MagnumFont/MagnumFont.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/MagnumPlugins/MagnumFont/MagnumFont.cpp b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp index 5161301cf..a0d80bd8b 100644 --- a/src/MagnumPlugins/MagnumFont/MagnumFont.cpp +++ b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp @@ -155,10 +155,10 @@ Vector2 MagnumFont::doGlyphAdvance(const UnsignedInt glyph) { Containers::Pointer MagnumFont::doCreateGlyphCache() { /* Set cache image */ - Containers::Pointer cache(new Text::GlyphCache( + Containers::Pointer cache{InPlaceInit, _opened->conf.value("originalImageSize"), _opened->image->size(), - _opened->conf.value("padding"))); + _opened->conf.value("padding")}; cache->setImage({}, *_opened->image); /* Fill glyph map */ @@ -166,7 +166,8 @@ Containers::Pointer MagnumFont::doCreateGlyphCache() { for(std::size_t i = 0; i != glyphs.size(); ++i) cache->insert(i, glyphs[i]->value("position"), glyphs[i]->value("rectangle")); - return cache; + /* GCC 4.8 needs extra help here */ + return Containers::Pointer{Utility::move(cache)}; } Containers::Pointer MagnumFont::doLayout(const AbstractGlyphCache& cache, Float size, const std::string& text) { @@ -180,7 +181,7 @@ Containers::Pointer MagnumFont::doLayout(const AbstractGlyphCa glyphs.push_back(it == _opened->glyphId.end() ? 0 : it->second); } - return Containers::Pointer(new MagnumFontLayouter(_opened->glyphAdvance, cache, this->size(), size, Utility::move(glyphs))); + return Containers::pointer(_opened->glyphAdvance, cache, this->size(), size, Utility::move(glyphs)); } namespace {