Client: Fix copying shm buffer data with fractional scaling
The QWaylandShmBackingStore computes the device pixels in the source image manually. But it does not match what the QPainter does one to one. Visually, it produces artifacts where the contents of an app is jiggling or moves back and forth by one pixel. In order to address the issue, the QWaylandShmBackingStore can copy whole buffers but with a clip region set. That way, the QPainter can consistently compute the coordinates in the device pixels. Pick-to: 6.9 Change-Id: Ib4832c4d687f43f6cc1de4a1760c32f1abd2ab03 Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
f197456481
commit
26968c3802
@ -364,13 +364,8 @@ bool QWaylandShmBackingStore::recreateBackBufferIfNeeded()
|
||||
|
||||
QPainter painter(targetImage);
|
||||
painter.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
|
||||
const qreal sourceDevicePixelRatio = sourceImage->devicePixelRatio();
|
||||
for (const QRect &rect : buffer->dirtyRegion()) {
|
||||
QRectF sourceRect(QPointF(rect.topLeft()) * sourceDevicePixelRatio,
|
||||
QSizeF(rect.size()) * sourceDevicePixelRatio);
|
||||
painter.drawImage(rect, *sourceImage, sourceRect);
|
||||
}
|
||||
painter.setClipRegion(buffer->dirtyRegion());
|
||||
painter.drawImage(QRectF(QPointF(), targetImage->deviceIndependentSize()), *sourceImage, sourceImage->rect());
|
||||
}
|
||||
|
||||
mBackBuffer = buffer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user