diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-03-26 17:59:39 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-03-30 08:41:49 +0000 |
commit | 6fe60cd9f2966b141f70b0a223b93173505b2ecb (patch) | |
tree | f91c80eb62c1983dff60a59b551e259955bb08f2 /src/plugins/platforms/xcb/qxcbwindow.cpp | |
parent | 1a542f25447686ab7a5eea759a33f20ce9eeaacc (diff) |
xcb: Fix bgr888 VNC sessions
Introduce a slow path for 24 and 32 bit BGR. We don't care about
performance here but it has to show the correct colors.
Task-number: QTBUG-42776
Change-Id: Ic73e8ca3950b2b956f06643165dcfac51e7540f3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbwindow.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 45245a1454..1406270994 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -182,8 +182,10 @@ static inline bool isTransient(const QWindow *w) || w->type() == Qt::Popup; } -static inline QImage::Format imageFormatForVisual(int depth, quint32 red_mask, quint32 blue_mask) +static inline QImage::Format imageFormatForVisual(int depth, quint32 red_mask, quint32 blue_mask, bool *rgbSwap) { + if (rgbSwap) + *rgbSwap = false; switch (depth) { case 32: if (blue_mask == 0xff) @@ -192,6 +194,11 @@ static inline QImage::Format imageFormatForVisual(int depth, quint32 red_mask, q return QImage::Format_A2BGR30_Premultiplied; if (blue_mask == 0x3ff) return QImage::Format_A2RGB30_Premultiplied; + if (red_mask == 0xff) { + if (rgbSwap) + *rgbSwap = true; + return QImage::Format_ARGB32_Premultiplied; + } break; case 30: if (red_mask == 0x3ff) @@ -202,6 +209,11 @@ static inline QImage::Format imageFormatForVisual(int depth, quint32 red_mask, q case 24: if (blue_mask == 0xff) return QImage::Format_RGB32; + if (red_mask == 0xff) { + if (rgbSwap) + *rgbSwap = true; + return QImage::Format_RGB32; + } break; case 16: if (blue_mask == 0x1f) @@ -296,7 +308,7 @@ void QXcbWindow::create() m_depth = platformScreen->screen()->root_depth; m_visualId = platformScreen->screen()->root_visual; const xcb_visualtype_t *visual = platformScreen->visualForId(m_visualId); - m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask); + m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap); connection()->addWindowEventListener(m_window, this); return; } @@ -368,7 +380,7 @@ void QXcbWindow::create() if (visualInfo) { m_depth = visualInfo->depth; - m_imageFormat = imageFormatForVisual(visualInfo->depth, visualInfo->red_mask, visualInfo->blue_mask); + m_imageFormat = imageFormatForVisual(visualInfo->depth, visualInfo->red_mask, visualInfo->blue_mask, &m_imageRgbSwap); Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), xcb_parent_id, visualInfo->visual, AllocNone); XSetWindowAttributes a; @@ -421,7 +433,7 @@ void QXcbWindow::create() } const xcb_visualtype_t *visual = platformScreen->visualForId(m_visualId); - m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask); + m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap); Q_XCB_CALL(xcb_create_window(xcb_connection(), m_depth, |