From c309c9f572a331881c515d7715d474ef854ea958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 26 Jun 2023 20:25:16 +0200 Subject: [PATCH] wayland: surface_scale(): assert surface width/height is a multiple of scale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When doing legacy scaling (non-fractional scaling), assert the surface’s width and height are multiples of the (integer) scale. --- wayland.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wayland.c b/wayland.c index 28bb2b6f..ce0e879f 100644 --- a/wayland.c +++ b/wayland.c @@ -1908,6 +1908,13 @@ wayl_surface_scale_explicit_width_height( #endif } else { LOG_DBG("scaling by a factor of %.2f (legacy)", scale); + + xassert(scale == floor(scale)); + + const int iscale = (int)scale; + xassert(width % iscale == 0); + xassert(height % iscale == 0); + wl_surface_set_buffer_scale(surf->surf, (int)scale); } }