From 849a640eb5183a57f5dc9e2feefc9095ea5830d2 Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Sat, 23 May 2020 12:37:04 +0200 Subject: [PATCH] Clamp height in Image_Center --- src/native/unix/scalar.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/native/unix/scalar.cpp b/src/native/unix/scalar.cpp index bf2b26c..0684534 100644 --- a/src/native/unix/scalar.cpp +++ b/src/native/unix/scalar.cpp @@ -97,6 +97,9 @@ extern "C" void Image_center( int new_height = h - y_offset; source += y_offset * s; + if (new_height > window_height) + new_height = window_height; + if (w > window_width) { int x_offset = (w - window_width) / 2; source += x_offset;