mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Clamp height in Image_Center
This commit is contained in:
parent
31d872353c
commit
849a640eb5
|
@ -97,6 +97,9 @@ extern "C" void Image_center(
|
||||||
int new_height = h - y_offset;
|
int new_height = h - y_offset;
|
||||||
source += y_offset * s;
|
source += y_offset * s;
|
||||||
|
|
||||||
|
if (new_height > window_height)
|
||||||
|
new_height = window_height;
|
||||||
|
|
||||||
if (w > window_width) {
|
if (w > window_width) {
|
||||||
int x_offset = (w - window_width) / 2;
|
int x_offset = (w - window_width) / 2;
|
||||||
source += x_offset;
|
source += x_offset;
|
||||||
|
|
Loading…
Reference in a new issue