Skip to content

Client: Fix buffer damage (+ context commit)

Client: Fix buffer damage

If the specified damage rectangle has fractional coordinates in the buffer
local coordinate space, the buffer damage needs to be expanded, i.e.

- bufferRect.left = floor(rect.left * scale)
- bufferRect.right = ceil(rect.right * scale) = ceil((rect.x + rect.width) * scale)

Flooring the coordinates and ceiling the size is not enough. It can
produce incorrect results.

For example, consider that a rectangle with logical coordinates of
QRect(0, 23, 179, 46) has been damaged in a window with scale 1.5. When
flooring the coordinates and ceiling the size, the following buffer
damage rect will be produced: QRect(0, 34, 269, 69). Its height is off by
1, the expected height is 70 (ceil((23 + 46) * 1.5) - floor(23 * 1.5) =
ceil(103.5) - floor(34.5) = 104 - 34 = 70).

Pick-to: 5.15 6.5 6.6
Change-Id: I927e75a2224bb58b4634125011d1305dbdfbb3aa
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit d79db699866b37bd3e3358ca18a210dfc5c0b4b9)

Replace scale with devicePixelRatio for non-integer scaling

The 'scale' event from wayland cannot support non-integer scaling
which was originally supported in Qt.

As default, devicePixelRatio follows the 'scale' so that the high DPI
still works as the mechanism in Wayland. But if non-integer scaling
factor such as 150% is needed, it can be supported to override the
devicePixelRatio.

Change-Id: I63a04db27bd521264b6d0904e1ddd05a572dc970
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Jungi Byun <jungi.byun@lge.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit cf98abbc6ae9ba9373803ffe193f839324e0c80b)

Merge request reports