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

Painting sub-rectangles with QGradient::StretchToDeviceMode on X11

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 4.7.1
    • GUI: Painting
    • None
    • OpenSuse 11.2, X11

    Description

      When filling a rectangle on X11 with a linear gradient in QGradient::StretchToDeviceMode the size of the rectangle is used for calculating the gradient instead of the size of the paint device. A possible workaround is to paint the complete device rectangle with a clip for the target rectangle, but this is much slower for small rectangles and introduces a heavy performance bottleneck for paint events with small regions ( on my box it takes ~300 ms to draw a rectangle in screen size ).
      ( From reading qwidget.cpp I would expect that this bug affects the implementation of QWidgetPrivate::paintBackground -> fillRegion. )

      The attached code below demonstrates the problem. ( with "-graphicssystem raster" all is fine ).

      One comment: the performance of filling a region with a gradient seems to depend on the size of the bounding rectangle of the clip region not of the size of its clip rectangles itsself. F.e. having a region that consists of the 2 pixels top-left + bottom-right is not faster filled than the complete rectangle. When iterating over the rectangles manually ( with only one rectangle set as clip ) the performance is much faster ( 0 instead of the 300 ms in my example ).

      Finally I'd like to point your attention to styled backgrounds, where the background of the parent widget is always painted completely even if only small parts ( when the child has rounded borders ) or nothing is visible at all. In combination with backgrounds with gradients this is serious performance bottleneck when working with style sheets.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rodal Samuel Rødal
            uweewu Uwe Rathmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes