From 0addef625ae5525bc32c3e998ad2d21c1ff892c3 Mon Sep 17 00:00:00 2001 From: neonloop Date: Wed, 4 Aug 2021 15:18:40 +0000 Subject: Switches to aspect scaling if the screen is too small for no scaling --- scale.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scale.c b/scale.c index 79432db..f9270ff 100644 --- a/scale.c +++ b/scale.c @@ -835,7 +835,8 @@ static void scale_select_scaler(unsigned w, unsigned h, size_t pitch) { dst_w = SCREEN_WIDTH; dst_h = SCREEN_HEIGHT; dst_offs = 0; - } else if (scale_size == SCALE_SIZE_ASPECT) { + } else if (scale_size == SCALE_SIZE_ASPECT || + (scale_size == SCALE_SIZE_NONE && w > SCREEN_WIDTH || h > SCREEN_HEIGHT)) { dst_w = SCREEN_WIDTH; dst_h = SCREEN_WIDTH / aspect_ratio + 0.5; dst_offs = ((SCREEN_HEIGHT-dst_h)/2) * SCREEN_PITCH; @@ -845,7 +846,7 @@ static void scale_select_scaler(unsigned w, unsigned h, size_t pitch) { dst_h = SCREEN_HEIGHT; dst_offs = ((SCREEN_WIDTH-dst_w)/2); } - } else if (scale_size == SCALE_SIZE_NONE && w <= SCREEN_WIDTH && h <= SCREEN_HEIGHT) { + } else if (scale_size == SCALE_SIZE_NONE) { unsigned dst_x = ((SCREEN_WIDTH - w) * SCREEN_BPP / 2); unsigned dst_y = ((SCREEN_HEIGHT - h) / 2); dst_offs = dst_y * SCREEN_PITCH + dst_x; -- cgit v1.2.3