Avoid redundant per-call FontKey hashing in QCDistanceFieldGlyphCache


Every fillText() call reconstructed a FontKey and hashed it against
m_glyphCaches up to 6 times (generate() plus getCurrentTextures()/
getOldTextures()/setOldTexture(), each re-deriving their own FontKey
from a second QRawFont::fromFont() call) even when the font was
unchanged from the previous call. Added fontKeyDataFor(), a fast path
keyed on the QFontEngine* pointer that skips the FontKey/hash entirely
in that case; generate()/generateFromShapedText() now return the
resolved FontKeyData* so callers reuse it instead of re-deriving one.

Safe because the fast path only fires when the font engine pointer
still matches the previous call; any mismatch falls back to the same
m_glyphCaches lookup as before, so returned textures/behavior are
unchanged. Confirmed via callgrind on an unchanging-font workload:
qHash(FontKey)'s share drops ~69%, total instructions ~10%.

Also remove unused rawFont member from struct FontKeyData.

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