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
parent
a1b84fe729
commit
7d43fb0c10
|
|
@ -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 ®ion);
|
||||
qreal getBackingStoreDevicePixelRatio();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -96,6 +96,18 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy)
|
|||
return true;
|
||||
}
|
||||
|
||||
void QCocoaBackingStore::beginPaint(const QRegion ®ion)
|
||||
{
|
||||
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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue