summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qwindowsurface_raster.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-09-28 15:22:56 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-09-29 13:24:12 +0200
commitb56dbaf5b3247bd8e87e4e856ad845593755c10c (patch)
tree7f46a8449105db476e7dfc7496a552ff805552cd /src/gui/painting/qwindowsurface_raster.cpp
parentfef5d7b0cbfba93ca108ce9f0785826c0a4ff829 (diff)
Fixed broken window surface flush when depth is 24 and bpp is not 32.
Some X servers use a compact representation of 24 depth visuals. In that case we can't use the shared memory or XPutImage paths, as Qt's RGB32 does not match the internal memory layout. Also fixed QPixmap::fromImage() to work in this case to prevent the red and blue channels from being swapped. Task-number: QTBUG-21754 Reviewed-by: Alberto Mardegan
Diffstat (limited to 'src/gui/painting/qwindowsurface_raster.cpp')
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index 15ff044977..2a25bff712 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -254,8 +254,9 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
} else
#endif
{
+ int depth = widget->x11Info().depth();
const QImage &src = d->image->image;
- if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) {
+ if (src.format() != QImage::Format_RGB32 || depth < 24 || X11->bppForDepth.value(depth) != 32) {
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());
@@ -267,7 +268,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
} 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);
- qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), widget->x11Info().depth());
+ qt_x11_drawImage(br, wpos, src, widget->handle(), d_ptr->gc, X11->display, (Visual *)widget->x11Info().visual(), depth);
}
}