aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-06-26 18:25:16 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-06-29 13:38:24 +0000
commitc309c9f572a331881c515d7715d474ef854ea958 (patch)
tree26819f31bc8a4add8d2c39c93ace7a39eaf2ebfb
parentwayland: warn when fractional scaling isn’t available (diff)
wayland: surface_scale(): assert surface width/height is a multiple of scale
When doing legacy scaling (non-fractional scaling), assert the surface’s width and height are multiples of the (integer) scale.
-rw-r--r--wayland.c7
1 files changed, 7 insertions, 0 deletions
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);
}
}