diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-05-02 23:03:39 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2020-05-05 18:58:35 +0200 |
commit | 6da4ff824e5ea8581370e774edcad265d83e3562 (patch) | |
tree | 08225e81751d28e2b002e5ad38210b9be620ee8f /src/gui/text/qfontengine_qpf2.cpp | |
parent | 4ab2abf37981e7dcdfaa92a2b6a788495d7ce5a4 (diff) |
Port two more local QSets to QDuplicateTrackers
Apart from a more fitting, minimal, API, QDuplicateTracker also
transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or
at least reduce, memory allocations.
Change-Id: Ia9e837ebba88aeb1916da041fc8460a0692a03e4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/text/qfontengine_qpf2.cpp')
-rw-r--r-- | src/gui/text/qfontengine_qpf2.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp index d636bca510..7178ef2928 100644 --- a/src/gui/text/qfontengine_qpf2.cpp +++ b/src/gui/text/qfontengine_qpf2.cpp @@ -44,6 +44,7 @@ #include <QtCore/QDir> #include <QtCore/QBuffer> #include <QtCore/private/qstringiterator_p.h> +#include <QtCore/private/qduplicatetracker_p.h> #include <QtGui/private/qpaintengine_raster_p.h> #include <QtGui/private/qguiapplication_p.h> @@ -346,7 +347,7 @@ bool QFontEngineQPF2::stringToCMap(const QChar *str, int len, QGlyphLayout *glyp } #if defined(DEBUG_FONTENGINE) - QSet<QChar> seenGlyphs; + QDuplicateTracker<QChar> seenGlyphs; #endif int glyph_pos = 0; @@ -366,10 +367,8 @@ bool QFontEngineQPF2::stringToCMap(const QChar *str, int len, QGlyphLayout *glyp glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, cmapSize, uc); #if 0 && defined(DEBUG_FONTENGINE) QChar c(uc); - if (!findGlyph(glyphs[glyph_pos].glyph) && !seenGlyphs.contains(c)) + if (!findGlyph(glyphs[glyph_pos].glyph) && !seenGlyphs.hasSeen(c)) qDebug() << "glyph for character" << c << '/' << Qt::hex << uc << "is" << Qt::dec << glyphs[glyph_pos].glyph; - - seenGlyphs.insert(c); #endif ++glyph_pos; } |