summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qnativeimage.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/image/qnativeimage.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/image/qnativeimage.cpp')
-rw-r--r--src/gui/image/qnativeimage.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index aebcbafd29..e1382dd747 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -153,7 +153,12 @@ QImage::Format QNativeImage::systemFormat()
QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget)
: xshmimg(0), xshmpm(0)
{
- if (!X11->use_mitshm) {
+ QX11Info info = widget->x11Info();
+
+ int dd = info.depth();
+ Visual *vis = (Visual*) info.visual();
+
+ if (!X11->use_mitshm || format != QImage::Format_RGB16 && X11->bppForDepth.value(dd) != 32) {
image = QImage(width, height, format);
// follow good coding practice and set xshminfo attributes, though values not used in this case
xshminfo.readOnly = true;
@@ -163,11 +168,6 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /*
return;
}
- QX11Info info = widget->x11Info();
-
- int dd = info.depth();
- Visual *vis = (Visual*) info.visual();
-
xshmimg = XShmCreateImage(X11->display, vis, dd, ZPixmap, 0, &xshminfo, width, height);
if (!xshmimg) {
qWarning("QNativeImage: Unable to create shared XImage.");