summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsbackingstore.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-01-21 08:17:21 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-01-21 08:17:21 +0100
commit158a3a4159bdc5a49caecd63e021dacbc06cf23c (patch)
treec3ed9aee6cabd46e5e8615b3815b92d32857c4da /src/plugins/platforms/windows/qwindowsbackingstore.cpp
parent26ece94a68fb5ae680c5639716b06c4e1ae979a8 (diff)
parent7b2fb038ae4b8b9231ae989ad309b6eca107a858 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsbackingstore.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
index 298562e12f..0f41d01716 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
@@ -45,6 +45,7 @@
#include <QtGui/QWindow>
#include <QtGui/QPainter>
#include <private/qhighdpiscaling_p.h>
+#include <private/qimage_p.h>
#include <QtCore/QDebug>
@@ -58,7 +59,8 @@ QT_BEGIN_NAMESPACE
*/
QWindowsBackingStore::QWindowsBackingStore(QWindow *window) :
- QPlatformBackingStore(window)
+ QPlatformBackingStore(window),
+ m_alphaNeedsFill(false)
{
qCDebug(lcQpaBackingStore) << __FUNCTION__ << this << window;
}
@@ -150,8 +152,16 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion &region)
<< " from: " << (m_image.isNull() ? QSize() : m_image->image().size());
}
#endif
- const QImage::Format format = window()->format().hasAlpha() ?
- QImage::Format_ARGB32_Premultiplied : QWindowsNativeImage::systemFormat();
+ QImage::Format format = window()->format().hasAlpha() ?
+ QImage::Format_ARGB32_Premultiplied : QWindowsNativeImage::systemFormat();
+
+ // The backingstore composition (enabling render-to-texture widgets)
+ // punches holes in the backingstores using the alpha channel. Hence
+ // the need for a true alpha format.
+ if (QImage::toPixelFormat(format).alphaUsage() == QPixelFormat::UsesAlpha)
+ m_alphaNeedsFill = true;
+ else // upgrade but here we know app painting does not rely on alpha hence no need to fill
+ format = qt_alphaVersionForPainting(format);
QWindowsNativeImage *oldwni = m_image.data();
QWindowsNativeImage *newwni = new QWindowsNativeImage(size.width(), size.height(), format);
@@ -192,7 +202,7 @@ void QWindowsBackingStore::beginPaint(const QRegion &region)
if (QWindowsContext::verbose > 1)
qCDebug(lcQpaBackingStore) <<__FUNCTION__ << region;
- if (m_image->image().hasAlphaChannel()) {
+ if (m_alphaNeedsFill) {
QPainter p(&m_image->image());
p.setCompositionMode(QPainter::CompositionMode_Source);
const QColor blank = Qt::transparent;