From 7f91480dbb04ae5b6c2b49d87141b27b0a829d2f Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 18 Jan 2020 00:11:56 +0100 Subject: [PATCH] Pre_load() sets context->Width & context->Height --- src/cpcformats.c | 3 --- src/fileformats.c | 17 +++++++---------- src/miscfileformats.c | 22 ++++++++++------------ 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/src/cpcformats.c b/src/cpcformats.c index 224b8564..f5c78d41 100644 --- a/src/cpcformats.c +++ b/src/cpcformats.c @@ -1618,9 +1618,6 @@ void Load_PPH(T_IO_Context* context) Pre_load(context, width, height, file_size, FORMAT_PPH, context->Ratio, 0); - context->Width = width; - context->Height = height; - // First of all, detect the mode // 0, 1, 2 > Load as with SCR files? // R(3) > Load as single layer, square pixels, 16 colors diff --git a/src/fileformats.c b/src/fileformats.c index d7621da6..cfd1807e 100644 --- a/src/fileformats.c +++ b/src/fileformats.c @@ -128,9 +128,6 @@ void Load_IMG(T_IO_Context * context) { memcpy(context->Palette,IMG_header.Palette,sizeof(T_Palette)); - context->Width=IMG_header.Width; - context->Height=IMG_header.Height; - for (y_pos=0;(y_posHeight) && (!File_error);y_pos++) { if (Read_bytes(file,buffer,context->Width)) @@ -3292,14 +3289,14 @@ void Load_PCX(T_IO_Context * context) Read_word_le(file,&(PCX_header.Screen_Y)) && Read_bytes(file,&(PCX_header.Filler),54) ) { - - context->Width=PCX_header.X_max-PCX_header.X_min+1; - context->Height=PCX_header.Y_max-PCX_header.Y_min+1; + Pre_load(context, + PCX_header.X_max - PCX_header.X_min + 1, + PCX_header.Y_max - PCX_header.Y_min + 1, + file_size, FORMAT_PCX, PIXEL_SIMPLE, + PCX_header.Plane * PCX_header.Depth); - Original_screen_X=PCX_header.Screen_X; - Original_screen_Y=PCX_header.Screen_Y; - - Pre_load(context, context->Width, context->Height, file_size, FORMAT_PCX, PIXEL_SIMPLE, PCX_header.Plane * PCX_header.Depth); + Original_screen_X = PCX_header.Screen_X; + Original_screen_Y = PCX_header.Screen_Y; if (!(PCX_header.Plane==3 && PCX_header.Depth==8)) { diff --git a/src/miscfileformats.c b/src/miscfileformats.c index 88558348..cc05f7bb 100644 --- a/src/miscfileformats.c +++ b/src/miscfileformats.c @@ -574,8 +574,6 @@ void Load_PKM(T_IO_Context * context) if (File_error==0) { - context->Width=header.Width; - context->Height=header.Height; image_size=(dword)(context->Width*context->Height); // Palette lue en 64 memcpy(context->Palette,header.Palette,sizeof(T_Palette)); @@ -945,13 +943,12 @@ void Load_CEL(T_IO_Context * context) && ( (((header1.Width+1)>>1)*header1.Height)==(file_size-header_size) ) ) { // Chargement d'un fichier CEL sans signature (vieux fichiers) - context->Width=header1.Width; - context->Height=header1.Height; - Original_screen_X=context->Width; - Original_screen_Y=context->Height; - Pre_load(context, context->Width,context->Height,file_size,FORMAT_CEL,PIXEL_SIMPLE,0); + Pre_load(context, header1.Width, header1.Height, + file_size, FORMAT_CEL, PIXEL_SIMPLE, 0); if (File_error==0) { + Original_screen_X = context->Width; + Original_screen_Y = context->Height; // Chargement de l'image /*Init_lecture();*/ for (y_pos=0;((y_posHeight) && (!File_error));y_pos++) @@ -984,13 +981,14 @@ void Load_CEL(T_IO_Context * context) { // Chargement d'un fichier CEL avec signature (nouveaux fichiers) - context->Width=header2.Width+header2.X_offset; - context->Height=header2.Height+header2.Y_offset; - Original_screen_X=context->Width; - Original_screen_Y=context->Height; - Pre_load(context, context->Width,context->Height,file_size,FORMAT_CEL,PIXEL_SIMPLE,0); + Pre_load(context, + header2.Width + header2.X_offset, + header2.Height + header2.Y_offset, + file_size, FORMAT_CEL, PIXEL_SIMPLE, 0); if (File_error==0) { + Original_screen_X = context->Width; + Original_screen_Y = context->Height; // Chargement de l'image /*Init_lecture();*/