summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbbackingstore.cpp
diff options
context:
space:
mode:
authorBłażej Szczygieł <spaz16@wp.pl>2016-01-14 01:50:38 +0100
committerBłażej Szczygieł <spaz16@wp.pl>2016-01-14 10:47:10 +0000
commit18119a58def4e3537dd92b86e9c6115e6a21e866 (patch)
tree6be38cbe8dd3da9c86bb014d7bb1a17a85c32233 /src/plugins/platforms/xcb/qxcbbackingstore.cpp
parentc3376ed3f90179586aa7a82730fa972dcd4cf5cd (diff)
xcb: Don't clear alpha on every repaint
Since 1bcfc3de7586ddb9f5d1b778b97b26ae3dc9584d every image has alpha in XCB even if it is not used by window. This patch prevents clearing the alpha channel on every repaint when window is not transparent. Change-Id: Icfdd39f8636401906ace77ea3c2fa25386979d5f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbbackingstore.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 006df320fe..c34bea0242 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -67,6 +67,8 @@ public:
QSize size() const { return m_qimage.size(); }
+ bool hasAlpha() const { return m_hasAlpha; }
+
void put(xcb_window_t window, const QPoint &dst, const QRect &source);
void preparePaint(const QRegion &region);
@@ -84,6 +86,8 @@ private:
xcb_window_t m_gc_window;
QRegion m_dirty;
+
+ bool m_hasAlpha;
};
class QXcbShmGraphicsBuffer : public QPlatformGraphicsBuffer
@@ -173,7 +177,8 @@ 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)
+ m_hasAlpha = QImage::toPixelFormat(format).alphaUsage() == QPixelFormat::UsesAlpha;
+ if (!m_hasAlpha)
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);
@@ -324,7 +329,7 @@ void QXcbBackingStore::beginPaint(const QRegion &region)
m_paintRegion = region;
m_image->preparePaint(m_paintRegion);
- if (m_image->image()->hasAlphaChannel()) {
+ if (m_image->hasAlpha()) {
QPainter p(paintDevice());
p.setCompositionMode(QPainter::CompositionMode_Source);
const QVector<QRect> rects = m_paintRegion.rects();