From ba42b3cb178051a4711e86a46c7a28fd3c28c533 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 5 Sep 2009 21:20:43 +0000 Subject: [PATCH] In fullscreen mode, auto-activate wide/tall pixels when you load a C64 multicolor picture, or a PNG picture you saved with wide/tall pixels. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1019 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- buttons.c | 34 +++++++++++++++++++++++++++++----- loadsave.h | 3 +++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/buttons.c b/buttons.c index 170fc4e0..96d2348f 100644 --- a/buttons.c +++ b/buttons.c @@ -2842,8 +2842,6 @@ void Load_picture(byte image) } new_mode=Best_video_mode(); - // TODO : Utiliser ici Ratio_of_loaded_image pour passer dans la - // bonne taille de pixels. if ((Config.Auto_set_res) && (new_mode!=Current_resolution)) { Init_mode_video( @@ -2853,6 +2851,20 @@ void Load_picture(byte image) Pixel_ratio); Display_menu(); } + // In window mode, activate wide or tall pixels if the image says so. + else if (!Video_mode[Current_resolution].Fullscreen && + ((Ratio_of_loaded_image == PIXEL_WIDE && + Pixel_ratio != PIXEL_WIDE && Pixel_ratio != PIXEL_WIDE2) || + (Ratio_of_loaded_image == PIXEL_TALL && + Pixel_ratio != PIXEL_TALL && Pixel_ratio != PIXEL_TALL2))) + { + Init_mode_video( + Video_mode[Current_resolution].Width, + Video_mode[Current_resolution].Height, + Video_mode[Current_resolution].Fullscreen, + Ratio_of_loaded_image); + Display_menu(); + } else { Main_offset_X=0; @@ -2932,9 +2944,7 @@ void Button_Reload(void) Main_magnifier_mode=0; } - new_mode=Best_video_mode(); - // TODO : Utiliser içi Ratio_of_loaded_image pour passer dans la - // bonne taille de pixels. + new_mode=Best_video_mode(); if ( ((Config.Auto_set_res) && (new_mode!=Current_resolution)) && (!Resolution_in_command_line) ) { @@ -2945,6 +2955,20 @@ void Button_Reload(void) Pixel_ratio); Display_menu(); } + // In window mode, activate wide or tall pixels if the image says so. + else if (!Video_mode[Current_resolution].Fullscreen && + ((Ratio_of_loaded_image == PIXEL_WIDE && + Pixel_ratio != PIXEL_WIDE && Pixel_ratio != PIXEL_WIDE2) || + (Ratio_of_loaded_image == PIXEL_TALL && + Pixel_ratio != PIXEL_TALL && Pixel_ratio != PIXEL_TALL2))) + { + Init_mode_video( + Video_mode[Current_resolution].Width, + Video_mode[Current_resolution].Height, + Video_mode[Current_resolution].Fullscreen, + Ratio_of_loaded_image); + Display_menu(); + } else { Main_offset_X=0; diff --git a/loadsave.h b/loadsave.h index e8fd0c83..93025ae8 100644 --- a/loadsave.h +++ b/loadsave.h @@ -55,3 +55,6 @@ extern T_Format File_formats[NB_KNOWN_FORMATS]; /// Function which attempts to save backups of the images (main and spare), /// called in case of SIGSEGV. void Image_emergency_backup(void); + +/// Pixel ratio of last loaded image: one of :PIXEL_SIMPLE, :PIXEL_WIDE or :PIXEL_TALL +extern enum PIXEL_RATIO Ratio_of_loaded_image;