QWaylandShmBackingStore: Clear in beginPaint based on surface format

It's the surface format that matters not the backing image format.
Now that QWaylandShmWindow sets a proper QSurfaceFormat, we can
actually check it.

Change-Id: Ia17a9f06cd335b6e8f6989051bc9d0cef9bfe3f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Kai Uwe Broulik 2025-03-09 09:59:47 +01:00
parent dfed8e3c3d
commit 732ea4faca

View File

@ -196,7 +196,7 @@ void QWaylandShmBackingStore::beginPaint(const QRegion &region)
// Although undocumented, QBackingStore::beginPaint expects the painted region // Although undocumented, QBackingStore::beginPaint expects the painted region
// to be cleared before use if the window has a surface format with an alpha. // to be cleared before use if the window has a surface format with an alpha.
// Fresh QWaylandShmBuffer are already cleared, so we don't need to clear those. // Fresh QWaylandShmBuffer are already cleared, so we don't need to clear those.
if (!bufferWasRecreated && mBackBuffer->image()->hasAlphaChannel()) { if (!bufferWasRecreated && window()->format().hasAlpha()) {
QPainter p(paintDevice()); QPainter p(paintDevice());
p.setCompositionMode(QPainter::CompositionMode_Source); p.setCompositionMode(QPainter::CompositionMode_Source);
const QColor blank = Qt::transparent; const QColor blank = Qt::transparent;