Avoid per-call QSet allocation/subtract in glyph reference tracking


populate() heap-allocated two fresh QSet<glyph_t> locals on every
call, then referenceGlyphs() did a real QSet::subtract() against
m_unusedGlyphs - all for what's typically a handful of glyph indices
per fillText()/fillShapedText() call. Neither local needs set
semantics: referencedGlyphs is only ever iterated once to remove()
each element (duplicates are a harmless no-op), and newGlyphs is
already deduplicated by the m_populatingGlyphs check in the same
loop. Switched both to QVarLengthArray<glyph_t, 16> and updated
requestGlyphs()/referenceGlyphs() to match - their bodies already
just iterated the argument, no set-specific behavior relied on.

m_populatingGlyphs/m_unusedGlyphs/m_referencedThisFrame/
m_referencedPrevFrame are unchanged; those need real membership
testing and a frame-boundary swap, which QSet still fits.

Confirmed via callgrind on a text-heavy fillShapedText() workload:
QSet<unsigned int>::subtract drops out of the profile entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Pick-to: 6.12
Change-Id: Id188e3be49163e65e09f6396dfccfcad7cc8a0e0
Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
commitb0f10ac17dd59eb81c78431e049cd46f4948472e
parent9374f0f58c681a6812226bfef0027b46a68505a1
authorPaul Olav Tvete <paul.tvete@qt.io>
committerPaul Olav Tvete <paul.tvete@qt.io>
commit timeTue, 18 Aug 2026 11:45:59 +0000