summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-10-15 21:05:08 +0200
committerOrgad Shaneh <orgad.shaneh@audiocodes.com>2017-10-16 22:21:52 +0300
commit01afc8c810201b93a12fe7030344e03566d99001 (patch)
tree27727b38370209dc158856b4bb4d32ccd2e49fbe /src/plugins/platforms/xcb
parenta090076e93487f8e461d9b866b9da1c0c21cb59b (diff)
parent49da5ce10034161017b261e000d4e9063d962401 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbimage.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qxcbimage.cpp b/src/plugins/platforms/xcb/qxcbimage.cpp
index 8635a03dcb..36536e0602 100644
--- a/src/plugins/platforms/xcb/qxcbimage.cpp
+++ b/src/plugins/platforms/xcb/qxcbimage.cpp
@@ -78,6 +78,16 @@ QImage::Format qt_xcb_imageFormatForVisual(QXcbConnection *connection, uint8_t d
&& visual->green_mask == 0xff00 && visual->blue_mask == 0xff)
return QImage::Format_RGB32;
+ if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
+ if (depth == 24 && format->bits_per_pixel == 32 && visual->blue_mask == 0xff0000
+ && visual->green_mask == 0xff00 && visual->red_mask == 0xff)
+ return QImage::Format_RGBX8888;
+ } else {
+ if (depth == 24 && format->bits_per_pixel == 32 && visual->blue_mask == 0xff00
+ && visual->green_mask == 0xff0000 && visual->red_mask == 0xff000000)
+ return QImage::Format_RGBX8888;
+ }
+
if (depth == 16 && format->bits_per_pixel == 16 && visual->red_mask == 0xf800
&& visual->green_mask == 0x7e0 && visual->blue_mask == 0x1f)
return QImage::Format_RGB16;
@@ -123,8 +133,9 @@ QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap
}
break;
}
- case QImage::Format_RGB32: // fall-through
- case QImage::Format_ARGB32_Premultiplied: {
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32_Premultiplied:
+ case QImage::Format_RGBX8888: {
uint *p = (uint*)image.scanLine(i);
uint *end = p + image.width();
while (p < end) {
@@ -141,7 +152,7 @@ QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap
}
// fix-up alpha channel
- if (format == QImage::Format_RGB32) {
+ if (format == QImage::Format_RGB32 || format == QImage::Format_RGBX8888) {
QRgb *p = (QRgb *)image.bits();
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x)