diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-10-05 10:24:42 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-10-05 11:21:10 (GMT) |
commit | 239eb516641ec6f99a5f4134042d3ab9c27c0a4d (patch) | |
tree | 0c225cecd8bbc5042b87f8dbcdbb4776dee492d2 /src/gui/painting/qwindowsurface_raster.cpp | |
parent | b8b13494ed151595c5fc104572655f667870e6e1 (diff) | |
download | Qt-239eb516641ec6f99a5f4134042d3ab9c27c0a4d.zip Qt-239eb516641ec6f99a5f4134042d3ab9c27c0a4d.tar.gz Qt-239eb516641ec6f99a5f4134042d3ab9c27c0a4d.tar.bz2 |
Improved performance in raster window surface for 16-bit displays.
Greatly improves performance in flush() for the non-MITSHM case on
16-bit displays. Instead of converting the whole image to a pixmap only
convert the sub-rect that's needed.
Reviewed-by: Gunnar
Diffstat (limited to 'src/gui/painting/qwindowsurface_raster.cpp')
-rw-r--r-- | src/gui/painting/qwindowsurface_raster.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 592b34c..2f7e879 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -219,11 +219,14 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi const QImage &src = d->image->image; br = br.intersected(src.rect()); if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) { + Q_ASSERT(src.depth() >= 16); + const QImage sub_src(src.scanLine(br.y()) + br.x() * (uint(src.depth()) / 8), + br.width(), br.height(), src.bytesPerLine(), src.format()); QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType); data->xinfo = widget->x11Info(); - data->fromImage(src, Qt::AutoColor); + data->fromImage(sub_src, Qt::NoOpaqueDetection); QPixmap pm = QPixmap(data); - XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, br.x() , br.y() , br.width(), br.height(), wbr.x(), wbr.y()); + XCopyArea(X11->display, pm.handle(), widget->handle(), d_ptr->gc, 0 , 0 , br.width(), br.height(), wbr.x(), wbr.y()); } else { // qpaintengine_x11.cpp extern void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const QImage &image, Drawable hd, GC gc, Display *dpy, Visual *visual, int depth); |