Clamp height in Image_Center

This commit is contained in:
Daniel Collin 2020-05-23 12:37:04 +02:00
parent 31d872353c
commit 849a640eb5

View file

@ -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;