Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-5055

Optimization: Implement a class that embodies text for which the layout and contents are mostly static

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.6.0
    • GUI: Text handling
    • 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.

      Attachments

        1. WastedTextPainting.png
          2 kB
          Warwick Allison (closed Nokia identity)
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            esabraha Eskil Abrahamsen Blomfeldt
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes