diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-02 05:23:55 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-02 05:23:55 (GMT) |
commit | b70d7a99f48d23da62683172b0088e1ffff904ee (patch) | |
tree | 55293982ffd3e79471e10f1bdd2cbe556cd5c9a6 /src | |
parent | 02a8ba7ce8e5ca07ed8e3e83f10a18acd6e38a10 (diff) | |
download | Qt-b70d7a99f48d23da62683172b0088e1ffff904ee.zip Qt-b70d7a99f48d23da62683172b0088e1ffff904ee.tar.gz Qt-b70d7a99f48d23da62683172b0088e1ffff904ee.tar.bz2 |
Minor perf tweaks
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/canvas/qsimplecanvas.cpp | 48 | ||||
-rw-r--r-- | src/declarative/canvas/qsimplecanvas_p.h | 2 |
2 files changed, 25 insertions, 25 deletions
diff --git a/src/declarative/canvas/qsimplecanvas.cpp b/src/declarative/canvas/qsimplecanvas.cpp index e582226..59edf74 100644 --- a/src/declarative/canvas/qsimplecanvas.cpp +++ b/src/declarative/canvas/qsimplecanvas.cpp @@ -830,24 +830,25 @@ void QSimpleCanvas::queueUpdate() void QSimpleCanvas::addDirty(QSimpleCanvasItem *c) { + Q_ASSERT(d->isSimpleCanvas()); queueUpdate(); - if (d->isSimpleCanvas()) { - d->oldDirty |= c->d_func()->data()->lastPaintRect; + d->oldDirty |= c->d_func()->data()->lastPaintRect; #if defined(QFX_RENDER_OPENGL) - // Check for filters - QSimpleCanvasItem *fi = c->parent(); - while(fi) { - if (fi->d_func()->data()->dirty) { - break; - } else if (fi->filter()) { - fi->update(); - break; - } - fi = fi->parent(); + // ### Is this parent crawl going to be a problem for scenes with nots + // of things changing? + // Check for filters + QSimpleCanvasItem *fi = c->parent(); + while(fi) { + if (fi->d_func()->data()->dirty) { + break; + } else if (fi->filter()) { + fi->update(); + break; } -#endif - d->dirtyItems.append(c); + fi = fi->parent(); } +#endif + d->dirtyItems.append(c); } QRect QSimpleCanvasPrivate::dirtyItemClip() const @@ -867,7 +868,7 @@ QRect QSimpleCanvasPrivate::dirtyItemClip() const return rv; } -QRegion QSimpleCanvasPrivate::resetDirty() +QRect QSimpleCanvasPrivate::resetDirty() { if (isSimpleCanvas()) { #if defined(QFX_RENDER_OPENGL) @@ -883,11 +884,11 @@ QRegion QSimpleCanvasPrivate::resetDirty() oldDirty = QRect(); if (fullUpdate()) - return QRegion(); + return QRect(); else - return QRegion(r); + return r; } else { - return QRegion(); + return QRect(); } } @@ -914,6 +915,7 @@ QSimpleCanvasItem *QSimpleCanvas::focusItem(QSimpleCanvasItem *item) const bool QSimpleCanvas::event(QEvent *e) { if (e->type() == QEvent::User && d->isSimpleCanvas()) { + int tbf = d->frameTimer.restart(); d->timer = 0; d->isSetup = true; #if defined(QFX_RENDER_OPENGL1) @@ -924,9 +926,7 @@ bool QSimpleCanvas::event(QEvent *e) d->root->d_func()->setupPainting(0, rect()); #endif - QRegion r = d->resetDirty(); - - int tbf = d->frameTimer.restart(); + QRect r = d->resetDirty(); #if defined(QFX_RENDER_QPAINTER) if (r.isEmpty() || fullUpdate()) @@ -935,12 +935,12 @@ bool QSimpleCanvas::event(QEvent *e) repaint(r); emit framePainted(); #else - QRect br = r.boundingRect(); - QRect nr(br.x(), height() - br.y() - br.height(), br.width(), br.height()); + + QRect nr(r.x(), height() - r.y() - r.height(), r.width(), r.height()); if (r.isEmpty() || fullUpdate()) d->egl.updateGL(); - else + else d->egl.updateGL(nr); emit framePainted(); #endif diff --git a/src/declarative/canvas/qsimplecanvas_p.h b/src/declarative/canvas/qsimplecanvas_p.h index d9ed4ac..b284c6c 100644 --- a/src/declarative/canvas/qsimplecanvas_p.h +++ b/src/declarative/canvas/qsimplecanvas_p.h @@ -126,7 +126,7 @@ public: #else QRect oldDirty; #endif - QRegion resetDirty(); + QRect resetDirty(); void paint(QPainter &p); |