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

QGraphicsItem scrolling always invalidates full scene in cached mode (exposedRect always has full item area)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.6.2
    • Widgets: GraphicsView
    • None
    • Symbian & Linux
    • abc0bd321356907dafc4a5cbca57a335a9f6ae3e, 1a0c51ffed4f7d86620b00adc3e22d044deef0c0

    Description

      QGraphicsItem scrolling always invalidates full scene if item in cached mode (setCacheMode(QGraphicsItem::ItemCoordinateCache)).
      This makes scrolling slower (especially of QGraphicsWebView on big pages), because paint method has to repaint the whole page.

      Reason on Symbian:
      In cached part of scroll method call to d->scene->d_func()->markDirty(this) invalidates the whole scene. This call is not necessary, because this code
      foreach (QRect rect, exposed.rects())
      update(rect);
      calls the same markDirty with correct rect (like d->scene->d_func()->markDirty(this, rect)).

      Patch that fixes this on Symbian:
      — qgraphicsitem.cpp.old 2010-02-19 17:54:30.000000000 -0500
      +++ qgraphicsitem.cpp 2010-02-19 16:23:22.000000000 -0500
      @@ -5461,7 +5461,7 @@
      exposed -= r.translated(dx, dy);
      foreach (QRect rect, exposed.rects())
      update(rect);

      • d->scene->d_func()->markDirty(this);
        +// d->scene->d_func()->markDirty(this);
        } else { update(rect); }

      On linux there is another problem in cached scrolling: QPixmapCache::find never able to find cached pixmap because c->key is invalid .

      Test application attached.

      Attachments

        1. graphicsscrolling_becnhmark_logs.zip
          14 kB
        2. hqt_10400.diff
          3 kB
        3. purebrowser.zip
          36 kB
        4. qgraphicsitem.cpp.diff
          0.4 kB
        5. qt_graphics.diff
          13 kB
        6. rect_combine.zip
          7 kB
        7. scroll.diff
          9 kB
        8. tst_graphicsscrolling.cpp
          7 kB

        Issue Links

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

          Activity

            People

              menard Alexis Menard (closed Nokia identity) (Inactive)
              ostapru Viatcheslav Ostapenko
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes