summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-10-06 10:41:09 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-10-06 11:07:14 (GMT)
commit6a061c1b66de4048222ef49c3d34c3e424e2a6c8 (patch)
tree1b046dea1a7942d8e7be5395361eb326087b2b50 /src/gui/painting
parent590b9b0e7587494e110cc3c498ff69ddab6f7520 (diff)
downloadQt-6a061c1b66de4048222ef49c3d34c3e424e2a6c8.zip
Qt-6a061c1b66de4048222ef49c3d34c3e424e2a6c8.tar.gz
Qt-6a061c1b66de4048222ef49c3d34c3e424e2a6c8.tar.bz2
Optimized window surfaces on X11 by not setting clip in the common case.
We don't need to set a clip when the flush only contains a single region. Not setting the clip gives us a slight performance boost. Reviewed-by: Trond
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp13
-rw-r--r--src/gui/painting/qwindowsurface_x11.cpp5
2 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index 2f7e879..3a118bd 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -140,7 +140,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
// Not ready for painting yet, bail out. This can happen in
// QWidget::create_sys()
- if (!d->image)
+ if (!d->image || rgn.numRects() == 0)
return;
#ifdef Q_WS_WIN
@@ -203,9 +203,11 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
wrgn.translate(-wOffset);
QRect wbr = wrgn.boundingRect();
- int num;
- XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num);
- XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded);
+ if (wrgn.numRects() != 1) {
+ int num;
+ XRectangle *rects = (XRectangle *)qt_getClipRects(wrgn, num);
+ XSetClipRectangles(X11->display, d_ptr->gc, 0, 0, rects, num, YXBanded);
+ }
QRect br = rgn.boundingRect().translated(offset);
#ifndef QT_NO_MITSHM
@@ -233,6 +235,9 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
qt_x11_drawImage(br, wbr.topLeft(), src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth());
}
}
+
+ if (wrgn.numRects() != 1)
+ XSetClipMask(X11->display, d_ptr->gc, XNone);
#endif // FALCON
#ifdef Q_WS_MAC
diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp
index 5e4433c..46c4c42 100644
--- a/src/gui/painting/qwindowsurface_x11.cpp
+++ b/src/gui/painting/qwindowsurface_x11.cpp
@@ -129,9 +129,12 @@ void QX11WindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint
// qDebug() << "XSetClipRectangles";
// for (int i = 0; i < num; ++i)
// qDebug() << ' ' << i << rects[i].x << rects[i].x << rects[i].y << rects[i].width << rects[i].height;
- XSetClipRectangles(X11->display, gc, 0, 0, rects, num, YXBanded);
+ if (num != 1)
+ XSetClipRectangles(X11->display, gc, 0, 0, rects, num, YXBanded);
XCopyArea(X11->display, d_ptr->device.handle(), widget->handle(), gc,
br.x() + offset.x(), br.y() + offset.y(), br.width(), br.height(), wbr.x(), wbr.y());
+ if (num != 1)
+ XSetClipMask(X11->display, gc, XNone);
}
void QX11WindowSurface::setGeometry(const QRect &rect)