From a6eec485b7b88ad83fcbeb8e98a8b680332bd53e Mon Sep 17 00:00:00 2001 From: Alexandr Pashchenko Date: Sun, 4 Aug 2024 15:45:00 +0600 Subject: [PATCH] Avoid the loss of a fractional part Fixes src/viewer.c:260 'ui_get_width()' was implicitly cast from 'size_t' type to 'double' Signed-off-by: Alexandr Pashchenko --- src/viewer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/viewer.c b/src/viewer.c index 408c033..f875c38 100644 --- a/src/viewer.c +++ b/src/viewer.c @@ -257,8 +257,8 @@ static void zoom_image(const char* params) } else if (str_to_num(params, 0, &percent, 0) && percent != 0 && percent > -1000 && percent < 1000) { // zoom in % - const double wnd_half_w = ui_get_width() / 2; - const double wnd_half_h = ui_get_height() / 2; + const double wnd_half_w = (double)ui_get_width() / 2; + const double wnd_half_h = (double)ui_get_height() / 2; const float step = (ctx.scale / 100) * percent; const double center_x = wnd_half_w / ctx.scale - ctx.img_x / ctx.scale; const double center_y = wnd_half_h / ctx.scale - ctx.img_y / ctx.scale;