Skip to content
Snippets Groups Projects
Commit 204ee7cd authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix issue with bitmap_drv_init_mode()

Because bitmap_get_scaled_win_size() was being clamped to maxsize,
no matter how much mult was incremented, w and h would never be
larger than maxwidth/maxheight and only under exceptional
circumstances would the be equal, which would result in an infinite
loop.

While we're here, set the integer scaling value so we're not chasing
ulps all over the place with floating point math/scaling when we
don't need to.
parent e1887edc
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4479 passed
......@@ -1876,7 +1876,7 @@ int bitmap_drv_init_mode(int mode, int *width, int *height, int maxwidth, int ma
ns = bs;
while (ns < os) {
mult++;
bitmap_get_scaled_win_size(mult, &w, &h, maxwidth, maxheight);
bitmap_get_scaled_win_size(mult, &w, &h, 0, 0);
if ((maxwidth > 0) && (w > maxwidth)) {
mult--;
ns = ls;
......@@ -1902,6 +1902,7 @@ int bitmap_drv_init_mode(int mode, int *width, int *height, int maxwidth, int ma
bitmap_get_scaled_win_size(mult, &w, &h, maxwidth, maxheight);
vstat.winwidth = w;
vstat.winheight = h;
vstat.scaling = mult;
return(0);
}
......
......@@ -926,6 +926,7 @@ gdi_textmode(int mode)
if (fullscreen) {
vstat.winwidth = mw;
vstat.winheight = mh;
vstat.scaling = bitmap_double_mult_inside(mw, mh);
}
gdi_setwinsize(vstat.winwidth, vstat.winheight);
pthread_mutex_unlock(&vstatlock);
......
......@@ -1169,7 +1169,8 @@ static void resize_window()
pthread_mutex_unlock(&vstatlock);
return;
}
resize = new_scaling != vstat.scaling;
bitmap_get_scaled_win_size(new_scaling, &width, &height, 0, 0);
resize = new_scaling != vstat.scaling || width != vstat.winwidth || height != vstat.winheight;
x_cvstat.scaling = vstat.scaling;
if (resize)
x11.XResizeWindow(dpy, win, width, height);
......@@ -1195,7 +1196,6 @@ static void init_mode_internal(int mode)
os = vstat.scaling;
bitmap_drv_init_mode(mode, NULL, NULL, mw, mh);
x_cvstat = vstat;
x_cvstat.scaling = bitmap_double_mult_inside(vstat.winwidth, vstat.winheight);
vstat.winwidth = ow;
vstat.winheight = oh;
vstat.scaling = os;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment