diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index b7937b4d84..5d3822d2cd 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -45,6 +45,7 @@ #include "qwindowscontext.h" #include +#include #include @@ -147,8 +148,10 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) nsp << " from: " << m_image->image().size(); } #endif - m_image.reset(new QWindowsNativeImage(size.width(), size.height(), - QWindowsNativeImage::systemFormat())); + QImage::Format format = QWindowsNativeImage::systemFormat(); + if (format == QImage::Format_RGB32 && rasterWindow()->window()->format().hasAlpha()) + format = QImage::Format_ARGB32; + m_image.reset(new QWindowsNativeImage(size.width(), size.height(), format)); } } @@ -168,9 +171,16 @@ bool QWindowsBackingStore::scroll(const QRegion &area, int dx, int dy) void QWindowsBackingStore::beginPaint(const QRegion ®ion) { - Q_UNUSED(region); if (QWindowsContext::verboseBackingStore > 1) qDebug() << __FUNCTION__; + + if (m_image->image().hasAlphaChannel()) { + QPainter p(&m_image->image()); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QColor blank = Qt::transparent; + foreach (const QRect &r, region.rects()) + p.fillRect(r, blank); + } } QWindowsWindow *QWindowsBackingStore::rasterWindow() const diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 649469ab9d..42abf046a9 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -272,7 +272,6 @@ void QXcbBackingStore::beginPaint(const QRegion ®ion) m_image->preparePaint(region); -#if 0 if (m_image->image()->hasAlphaChannel()) { QPainter p(m_image->image()); p.setCompositionMode(QPainter::CompositionMode_Source); @@ -282,7 +281,6 @@ void QXcbBackingStore::beginPaint(const QRegion ®ion) p.fillRect(*it, blank); } } -#endif } void QXcbBackingStore::endPaint(const QRegion &)