Clear backingstore for windows with alpha channel.

Fixes painting artifacts in translucent windows.

Change-Id: I89c198e5636c5387e67ad8839d32dffdc0a149cb
Task-number: QTBUG-43017
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
bb10
Morten Johan Sørvig 2015-03-11 13:03:43 +01:00 committed by Morten Johan Sørvig
parent a1b84fe729
commit 7d43fb0c10
2 changed files with 13 additions and 0 deletions

View File

@ -54,6 +54,7 @@ public:
QImage toImage() const;
void resize (const QSize &size, const QRegion &);
bool scroll(const QRegion &area, int dx, int dy);
void beginPaint(const QRegion &region);
qreal getBackingStoreDevicePixelRatio();
private:

View File

@ -96,6 +96,18 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy)
return true;
}
void QCocoaBackingStore::beginPaint(const QRegion &region)
{
if (m_qImage.hasAlphaChannel()) {
QPainter p(&m_qImage);
p.setCompositionMode(QPainter::CompositionMode_Source);
const QVector<QRect> rects = region.rects();
const QColor blank = Qt::transparent;
for (QVector<QRect>::const_iterator it = rects.begin(), end = rects.end(); it != end; ++it)
p.fillRect(*it, blank);
}
}
qreal QCocoaBackingStore::getBackingStoreDevicePixelRatio()
{
return m_qImage.devicePixelRatio();