mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-27 07:58:07 -04:00
wayl_surface_scale_explicit_width_height(): don’t assert width/height are valid for scale
This function is only called directly when scaling the mouse pointer. The mouse pointer is never guaranteed to have a valid width and height, so skip the width/height assertions for it.
This commit is contained in:
parent
1782474481
commit
764248bb0d
1 changed files with 28 additions and 7 deletions
35
wayland.c
35
wayland.c
|
|
@ -2000,18 +2000,31 @@ wayl_roundtrip(struct wayland *wayl)
|
||||||
wayl_flush(wayl);
|
wayl_flush(wayl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
wayl_surface_scale_explicit_width_height(
|
surface_scale_explicit_width_height(
|
||||||
const struct wl_window *win, const struct wayl_surface *surf,
|
const struct wl_window *win, const struct wayl_surface *surf,
|
||||||
int width, int height, float scale)
|
int width, int height, float scale, bool verify)
|
||||||
{
|
{
|
||||||
if (term_fractional_scaling(win->term)) {
|
if (term_fractional_scaling(win->term)) {
|
||||||
#if defined(HAVE_FRACTIONAL_SCALE)
|
#if defined(HAVE_FRACTIONAL_SCALE)
|
||||||
LOG_DBG("scaling by a factor of %.2f using fractional scaling "
|
LOG_DBG("scaling by a factor of %.2f using fractional scaling "
|
||||||
"(width=%d, height=%d) ", scale, width, height);
|
"(width=%d, height=%d) ", scale, width, height);
|
||||||
|
|
||||||
xassert((int)roundf(scale * (int)roundf(width / scale)) == width);
|
if (verify) {
|
||||||
xassert((int)roundf(scale * (int)roundf(height / scale)) == height);
|
if ((int)roundf(scale * (int)roundf(width / scale)) != width) {
|
||||||
|
BUG("width=%d is not valid with scaling factor %.2f (%d != %d)",
|
||||||
|
width, scale,
|
||||||
|
(int)roundf(scale * (int)roundf(width / scale)),
|
||||||
|
width);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((int)roundf(scale * (int)roundf(height / scale)) != height) {
|
||||||
|
BUG("height=%d is not valid with scaling factor %.2f (%d != %d)",
|
||||||
|
height, scale,
|
||||||
|
(int)roundf(scale * (int)roundf(height / scale)),
|
||||||
|
height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wl_surface_set_buffer_scale(surf->surf, 1);
|
wl_surface_set_buffer_scale(surf->surf, 1);
|
||||||
wp_viewport_set_destination(
|
wp_viewport_set_destination(
|
||||||
|
|
@ -2034,12 +2047,20 @@ wayl_surface_scale_explicit_width_height(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wayl_surface_scale_explicit_width_height(
|
||||||
|
const struct wl_window *win, const struct wayl_surface *surf,
|
||||||
|
int width, int height, float scale)
|
||||||
|
{
|
||||||
|
surface_scale_explicit_width_height(win, surf, width, height, scale, false);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wayl_surface_scale(const struct wl_window *win, const struct wayl_surface *surf,
|
wayl_surface_scale(const struct wl_window *win, const struct wayl_surface *surf,
|
||||||
const struct buffer *buf, float scale)
|
const struct buffer *buf, float scale)
|
||||||
{
|
{
|
||||||
wayl_surface_scale_explicit_width_height(
|
surface_scale_explicit_width_height(
|
||||||
win, surf, buf->width, buf->height, scale);
|
win, surf, buf->width, buf->height, scale, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue