From 1bcfc3de7586ddb9f5d1b778b97b26ae3dc9584d Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 6 Jan 2016 11:01:39 +0100 Subject: Use backing store formats with alpha We depend on being able to punch holes in the backing store when integrating with FBO elements. To do that we need a format with an alpha channel. This was only working previously because RGB32 didn't mask when filling or when converting to ARGB32_PM, but other formats didn't. Also unifies the logic for getting alpha versions of QImage formats. Task-number: QTBUG-50281 Change-Id: Ied1325f60e2b67d9ea2dfa9701b06fc2231ebfca Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 1825a463d0..006df320fe 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE @@ -172,6 +173,9 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI qWarning() << "QXcbBackingStore: Error while marking the shared memory segment to be destroyed"; } + if (QImage::toPixelFormat(format).alphaUsage() == QPixelFormat::IgnoresAlpha) + format = qt_alphaVersionForPainting(format); + m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format); m_graphics_buffer = new QXcbShmGraphicsBuffer(&m_qimage); } -- cgit v1.2.3 From f8301029183a0ff653243d932b135405adee20b0 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 24 Dec 2015 13:35:40 +0300 Subject: xcb: Remove QXcbScreen::m_nativeGeometry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is equal to m_geometry since c173a5071906867de9da26ee8f49224b23c2ef1d (Remove QT_DEVICE_PIXEL_RATIO support from xcb). Also remove the declaration for QXcbWindow::screenForNativeGeometry(), which was forgotten to be removed in that commit. Change-Id: I8ec425a3bc111ec579e2e25c4fda8a02f1c8d09c Reviewed-by: Błażej Szczygieł Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/xcb/qxcbscreen.cpp | 13 ++++--------- src/plugins/platforms/xcb/qxcbscreen.h | 2 -- src/plugins/platforms/xcb/qxcbwindow.h | 1 - 3 files changed, 4 insertions(+), 12 deletions(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index caddd2b2a5..f3d381b99e 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -70,7 +70,7 @@ QXcbVirtualDesktop::~QXcbVirtualDesktop() QXcbScreen *QXcbVirtualDesktop::screenAt(const QPoint &pos) const { foreach (QXcbScreen *screen, connection()->screens()) { - if (screen->virtualDesktop() == this && screen->nativeGeometry().contains(pos)) + if (screen->virtualDesktop() == this && screen->geometry().contains(pos)) return screen; } return Q_NULLPTR; @@ -198,17 +198,15 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe } else if (xineramaScreenInfo) { m_geometry = QRect(xineramaScreenInfo->x_org, xineramaScreenInfo->y_org, xineramaScreenInfo->width, xineramaScreenInfo->height); - m_nativeGeometry = m_geometry; m_availableGeometry = m_geometry & m_virtualDesktop->workArea(); m_sizeMillimeters = sizeInMillimeters(m_geometry.size(), virtualDpi()); if (xineramaScreenIdx > -1) m_outputName += QLatin1Char('-') + QString::number(xineramaScreenIdx); } - if (m_geometry.isEmpty()) { + if (m_geometry.isEmpty()) m_geometry = QRect(QPoint(), m_virtualSize); - m_nativeGeometry = QRect(QPoint(), m_virtualSize); - } + if (m_availableGeometry.isEmpty()) m_availableGeometry = m_geometry; @@ -557,7 +555,6 @@ void QXcbScreen::updateGeometry(const QRect &geom, uint8_t rotation) qreal dpi = xGeometry.width() / physicalSize().width() * qreal(25.4); m_pixelDensity = qRound(dpi/96); m_geometry = QRect(xGeometry.topLeft(), xGeometry.size()); - m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size()); m_availableGeometry = xGeometry & m_virtualDesktop->workArea(); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); } @@ -828,9 +825,7 @@ QDebug operator<<(QDebug debug, const QXcbScreen *screen) debug << ", screenNumber=" << screen->screenNumber(); debug << ", virtualSize=" << screen->virtualSize().width() << 'x' << screen->virtualSize().height() << " ("; formatSizeF(debug, screen->virtualSize()); - debug << "), nativeGeometry="; - formatRect(debug, screen->nativeGeometry()); - debug << ", orientation=" << screen->orientation(); + debug << "), orientation=" << screen->orientation(); debug << ", depth=" << screen->depth(); debug << ", refreshRate=" << screen->refreshRate(); debug << ", root=" << hex << screen->root(); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index dd7396aca2..f4de2b9dfd 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -114,7 +114,6 @@ public: QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE; QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; } - QRect nativeGeometry() const { return m_nativeGeometry; } QRect availableGeometry() const Q_DECL_OVERRIDE {return m_availableGeometry;} int depth() const Q_DECL_OVERRIDE { return screen()->root_depth; } QImage::Format format() const Q_DECL_OVERRIDE; @@ -186,7 +185,6 @@ private: QSizeF m_outputSizeMillimeters; QSizeF m_sizeMillimeters; QRect m_geometry; - QRect m_nativeGeometry; QRect m_availableGeometry; QSize m_virtualSize; QSizeF m_virtualSizeMillimeters; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 69c0819959..3cfa71c9e0 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -167,7 +167,6 @@ public: virtual void create(); virtual void destroy(); - QXcbScreen *screenForNativeGeometry(const QRect &newGeometry) const; public Q_SLOTS: void updateSyncRequestCounter(); -- cgit v1.2.3