Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
4.6.0
-
None
Description
When using drawText(), the contents and thus layout of the text is often the same over several subsequent calls. This is e.g. true for a button label, a menu item, etc.
However, much of the time spent inside drawText() is spent precisely on laying out the text. By introducing an API for drawing and maintaining static text (thus caching the layout information) we can minimize the effort for actually drawing the text, at the expense of some extra memory consumption.
Memory Consumption
The alternative to this requirement is to cache the entire text as a pixmap, so the extra memory consumption of cached layout information is expected to be a net saving.
Graphics Bandwidth
In a typical Latin1 text string, such as "Lorem ipsum dolor sit amet", a cached pixmap of the entire text area is 150% more source pixels than need to be read from the font glyphs - see the attached image where red pixels would be unnecessarily read from a cache of the entire text string.