diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 04fe558..4981ad3 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -43,7 +43,7 @@ #include "qwindowswindow.h" #include "qwindowsnativeimage.h" #include "qwindowscontext.h" - +#include #include #include @@ -88,6 +88,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, #ifndef Q_OS_WINCE if (rw->format().hasAlpha() && (window->flags() & Qt::FramelessWindowHint)) { + static int n = 0; const long wl = GetWindowLong(rw->handle(), GWL_EXSTYLE); if ((wl & WS_EX_LAYERED) == 0) SetWindowLong(rw->handle(), GWL_EXSTYLE, wl | WS_EX_LAYERED); @@ -103,7 +104,13 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, RECT dirty = {dirtyRect.x(), dirtyRect.y(), dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; + QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info); + + const QString fname = QString::fromLatin1("test%1.png").arg(n++, 3, 10, QLatin1Char('0')); + m_image->image().save(fname); + qDebug() << "wrote " << fname; + } else { #endif const HDC dc = rw->getDC(); @@ -142,8 +149,9 @@ 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 = rasterWindow()->format().hasAlpha() ? + QImage::Format_ARGB32 : QWindowsNativeImage::systemFormat(); + m_image.reset(new QWindowsNativeImage(size.width(), size.height(), format)); } }