diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2018-09-24 09:29:10 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2018-09-24 11:54:02 +0000 |
commit | e879254613469b1b5290fca31ea69cb6ea407c06 (patch) | |
tree | 398b6b8bd1c0fc399051daa9b638b09b406490a8 /src/doc | |
parent | e22971073ee10ee891c61a94f934b0b3403cc5a7 (diff) |
QText2DEntity: clear glyphrun when scene changes
GlyphRun stores a reference to glyphs and indirectly to a suitable TextureAtlas
based on the font needed by the glyphs.
Whenever we recompute the glyph because some property has changed we:
1) Store information about the glyph we need
2) Generate a Rendering Entity for the glyph we need
3) Dereference the glyphs we don't need anymore (the old glyph run)
Step 3) is performed last as whenever no more glyph reference a TextureAtlas,
it gets deleted. If we were to do that first, we could end up in cases where
we destroy the atlas and recreate it just after because the new GlyphRun actually
uses the same font.
TextureAtlases are tied to the lifetime of the scene's root node.
However if the scene changes, the previous glyph run wouldn't be released.
Since we don't keep a direct relationship between Glyphs and TextureAtlas
(we basically do a getOrCreateTextureAtlasForFont and lookup available atlases
in the scene), we could actually end up destroying a texture atlas we still need
the next time we update our glyph run:
When deferencing the old glyphs (whose texture atlas has been destroyed when the
scene has changed), we would instead be removing references to the new atlas
required by the new nodes (if they share the same font).
To fix that, whenever the scene changes, we now clear the glyph run as well.
Change-Id: Ibe62e2f6438c6655d2997681117c341302d64799
Task-number: QTBUG-70551
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/doc')
0 files changed, 0 insertions, 0 deletions