Skip to content

Commit

Permalink
Avoid the loss of a fractional part
Browse files Browse the repository at this point in the history
Fixes src/viewer.c:260 'ui_get_width()' was implicitly cast from 'size_t' type to 'double'

Signed-off-by: Alexandr Pashchenko <[email protected]>
  • Loading branch information
appashchenko committed Aug 4, 2024
1 parent 5a87cd9 commit a6eec48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/viewer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a6eec48

Please sign in to comment.