Clear backingstore for windows with alpha channel.
Fixes painting artifacts in translucent windows. Task-number: QTBUG-28531 Change-Id: I00a7a86f88a40d356fa3e37bd497a288b2118469 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
parent
ffd912a51d
commit
c95b0982d5
@ -45,6 +45,7 @@
|
||||
#include "qwindowscontext.h"
|
||||
|
||||
#include <QtGui/QWindow>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
@ -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
|
||||
|
@ -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 &)
|
||||
|
Loading…
Reference in New Issue
Block a user