diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-09-28 13:22:56 (GMT) |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-09-29 11:24:12 (GMT) |
commit | b56dbaf5b3247bd8e87e4e856ad845593755c10c (patch) | |
tree | 7f46a8449105db476e7dfc7496a552ff805552cd /src/gui/image/qpixmap_x11.cpp | |
parent | fef5d7b0cbfba93ca108ce9f0785826c0a4ff829 (diff) | |
download | Qt-b56dbaf5b3247bd8e87e4e856ad845593755c10c.zip Qt-b56dbaf5b3247bd8e87e4e856ad845593755c10c.tar.gz Qt-b56dbaf5b3247bd8e87e4e856ad845593755c10c.tar.bz2 |
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/qpixmap_x11.cpp')
-rw-r--r-- | src/gui/image/qpixmap_x11.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 77c2a2a..0e1401c 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -897,12 +897,20 @@ void QX11PixmapData::fromImage(const QImage &img, } ) break; - case BPP24_888: // 24 bit MSB + case BPP24_888: CYCLE( - for (int x=0; x<w; x++) { - *dst++ = qRed (*p); - *dst++ = qGreen(*p); - *dst++ = qBlue (*p++); + if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { + for (int x=0; x<w; x++) { + *dst++ = qRed (*p); + *dst++ = qGreen(*p); + *dst++ = qBlue (*p++); + } + } else { + for (int x=0; x<w; x++) { + *dst++ = qBlue (*p); + *dst++ = qGreen(*p); + *dst++ = qRed (*p++); + } } ) break; |