mirror of https://github.com/encounter/SDL.git
Fixed bug #4625: with integer scale, viewport (as reported by SDL_RenderGetViewport) becomes -2147483648x-2147483648
0 isn't valid scale. Min integer scale is 1.0f
This commit is contained in:
parent
a0cb079a42
commit
49369142bd
|
@ -2270,6 +2270,11 @@ UpdateLogicalSize(SDL_Renderer *renderer)
|
||||||
} else {
|
} else {
|
||||||
scale = (float)(h / renderer->logical_h);
|
scale = (float)(h / renderer->logical_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scale < 1.0f) {
|
||||||
|
scale = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
viewport.w = (int)SDL_floor(renderer->logical_w * scale);
|
viewport.w = (int)SDL_floor(renderer->logical_w * scale);
|
||||||
viewport.x = (w - viewport.w) / 2;
|
viewport.x = (w - viewport.w) / 2;
|
||||||
viewport.h = (int)SDL_floor(renderer->logical_h * scale);
|
viewport.h = (int)SDL_floor(renderer->logical_h * scale);
|
||||||
|
|
Loading…
Reference in New Issue