From f9dc86eb87ef1ad06004f3cb4965dabfd7aba14a Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Mon, 5 Mar 2018 23:53:37 +0100 Subject: [PATCH] Load_GIF(): Be more tolerant on ratio values --- src/fileformats.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/fileformats.c b/src/fileformats.c index a8e2cf5b..4a454f77 100644 --- a/src/fileformats.c +++ b/src/fileformats.c @@ -4087,18 +4087,14 @@ void Load_GIF(T_IO_Context * context) Original_screen_X=LSDB.Width; Original_screen_Y=LSDB.Height; - switch(LSDB.Aspect) { - case 17: // (17 + 15) / 64 = 1:2 - ratio=PIXEL_TALL; - break; - case 33: // (33 + 15) / 64 = 3:4 - ratio=PIXEL_TALL3; - break; - case 113: // (113 + 15) / 64 = 2:1 - ratio=PIXEL_WIDE; - break; - default: - ratio=PIXEL_SIMPLE; + ratio=PIXEL_SIMPLE; // (49 + 15) / 64 = 1:1 + if (LSDB.Aspect != 0) { + if (LSDB.Aspect < 25) // (17 + 15) / 64 = 1:2 + ratio=PIXEL_TALL; + else if (LSDB.Aspect < 41) // (33 + 15) / 64 = 3:4 + ratio=PIXEL_TALL3; + else if (LSDB.Aspect > 82) // (113 + 15) / 64 = 2:1 + ratio=PIXEL_WIDE; } Pre_load(context, LSDB.Width,LSDB.Height,file_size,FORMAT_GIF,ratio,(LSDB.Resol&7)+1);