mirror of https://github.com/encounter/SDL.git
Fixed bug #4625 - SDL_RenderSetLogicalSize issues
viewport becomes -2147483648x-2147483648 when logical_w/h is greater than window size. division should be done with floats
This commit is contained in:
parent
a948ff8494
commit
a50ca98e2b
|
@ -2266,9 +2266,9 @@ UpdateLogicalSize(SDL_Renderer *renderer)
|
||||||
|
|
||||||
if (renderer->integer_scale) {
|
if (renderer->integer_scale) {
|
||||||
if (want_aspect > real_aspect) {
|
if (want_aspect > real_aspect) {
|
||||||
scale = (float)(w / renderer->logical_w);
|
scale = (float)w / renderer->logical_w;
|
||||||
} else {
|
} else {
|
||||||
scale = (float)(h / renderer->logical_h);
|
scale = (float)h / renderer->logical_h;
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
|
Loading…
Reference in New Issue