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.
This commit is contained in:
Daniel Eklöf 2023-06-26 20:25:16 +02:00
parent 8a4efb3427
commit c309c9f572
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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);
}
}