From 2b232bbc4887be85b449829073db740641601f4e Mon Sep 17 00:00:00 2001 From: Franck Charlet Date: Mon, 20 Oct 2008 20:08:26 +0000 Subject: [PATCH] Improved the speed of the spread and swap commands in the palette window by only refreshing the logical palette instead of the physical one (at least it works on MacOSX, i don't know if it's any good on other versions) git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@292 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- .DS_Store | Bin 15364 -> 15364 bytes Grafx2.xcodeproj/project.pbxproj | 12 +-- Grafx2.xcodeproj/xx.pbxuser | 141 +++++++++++++++++++++++++++++-- Grafx2.xcodeproj/xx.perspective | 65 ++++++++------ divers.c | 11 ++- palette.c | 16 ++-- readline.c | 6 ++ sdlscreen.c | 4 +- 8 files changed, 197 insertions(+), 58 deletions(-) diff --git a/.DS_Store b/.DS_Store index a784fbe59ec4ec3b3003de177c75308ff99f140e..a7fc0cddf34518c7450bbf8078bbedb827decd78 100644 GIT binary patch delta 168 zcmZpvXsMWx$eiJsGx4JGWCI(L^ delta 195 zcmZpvXsMWx$eiq%Gx4JGWCI PBXSmartGroupTreeModuleOutlineStateExpansionKey - 29B97314FDCFA39411CA2CEA 1C37FBAC04509CD000000102 + F5B1EEA20EAD15CD00B087B5 + F5B1EEA30EAD15CD00B087B5 PBXSmartGroupTreeModuleOutlineStateSelectionKey @@ -307,7 +308,7 @@ PBXProjectModuleGUID F5B19BA70EA4BF24003F4BA4 PBXProjectModuleLabel - + divers.c PBXSplitModuleInNavigatorKey Split0 @@ -315,11 +316,16 @@ PBXProjectModuleGUID F5B19BA80EA4BF24003F4BA4 PBXProjectModuleLabel - + divers.c + _historyCapacity + 0 + bookmark + F5B1EEB90EAD1BCA00B087B5 history F5B19C160EA4D6E8003F4BA4 F5B1D1770EA5FE2100AB8D0F + F5B1EE860EAD0F5800B087B5 prevStack @@ -420,11 +426,11 @@ TableOfContents - F5AD4B120EA8C9D5009CCAC4 + F5B1EEA50EAD15CD00B087B5 1CA23ED40692098700951B8B - F5AD4B130EA8C9D5009CCAC4 + F5B1EEA60EAD15CD00B087B5 F5B19BA70EA4BF24003F4BA4 - F5AD4B140EA8C9D5009CCAC4 + F5B1EEA70EAD15CD00B087B5 1CA23EDF0692099D00951B8B 1CA23EE00692099D00951B8B 1CA23EE10692099D00951B8B @@ -484,9 +490,7 @@ PBXSmartGroupTreeModuleOutlineStateKey_v7 PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 29B97314FDCFA39411CA2CEA - + PBXSmartGroupTreeModuleOutlineStateSelectionKey @@ -494,7 +498,7 @@ PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 140}, {251, 580}} + {{0, 0}, {251, 180}} PBXTopSmartGroupGIDs @@ -504,14 +508,14 @@ GeometryConfiguration Frame - {{0, 0}, {268, 598}} + {{0, 0}, {268, 198}} GroupTreeTableConfiguration MainColumn 251 RubberWindowFrame - 23 92 1000 639 0 0 1024 746 + 22 503 975 239 0 0 1024 746 Module PBXSmartGroupTreeModule @@ -527,7 +531,7 @@ PBXProjectModuleGUID F5B19BA70EA4BF24003F4BA4 PBXProjectModuleLabel - + palette.c PBXSplitModuleInNavigatorKey Split0 @@ -535,16 +539,23 @@ PBXProjectModuleGUID F5B19BA80EA4BF24003F4BA4 PBXProjectModuleLabel - + palette.c + _historyCapacity + 0 + bookmark + F5B1EEBA0EAD1BCA00B087B5 history F5B19C160EA4D6E8003F4BA4 F5B1D1770EA5FE2100AB8D0F + F5B1EEA80EAD15CD00B087B5 + F5B1EEA90EAD15CD00B087B5 prevStack F5B1D1790EA5FE2100AB8D0F F5B1D1B70EA602BA00AB8D0F + F5B1EEAA0EAD15CD00B087B5 SplitCount @@ -558,25 +569,25 @@ GeometryConfiguration Frame - {{0, 0}, {727, 91}} + {{0, 0}, {702, 0}} RubberWindowFrame - 23 92 1000 639 0 0 1024 746 + 22 503 975 239 0 0 1024 746 Module PBXNavigatorGroup Proportion - 91pt + 0pt Proportion - 502pt + 193pt Tabs ContentConfiguration PBXBuildLogShowsTranscriptDefaultKey - {{0, 372}, {727, 103}} + {{0, 166}, {702, 0}} PBXProjectModuleGUID XCMainBuildResultsModuleGUID PBXProjectModuleLabel @@ -589,9 +600,9 @@ GeometryConfiguration Frame - {{10, 27}, {727, 475}} + {{10, 27}, {702, 166}} RubberWindowFrame - 23 92 1000 639 0 0 1024 746 + 22 503 975 239 0 0 1024 746 Module PBXBuildResultsModule @@ -653,7 +664,7 @@ Proportion - 727pt + 702pt Name @@ -671,14 +682,14 @@ TableOfContents - F5AD4B200EA8CCF4009CCAC4 + F5B1EEAC0EAD15CD00B087B5 1CA23EE50692099D00951B8B - F5AD4B210EA8CCF4009CCAC4 + F5B1EEAD0EAD15CD00B087B5 F5B19BA70EA4BF24003F4BA4 - F5AD4B220EA8CCF4009CCAC4 + F5B1EEAE0EAD15CD00B087B5 XCMainBuildResultsModuleGUID 1CA23EE80692099D00951B8B - F5AD4B230EA8CCF4009CCAC4 + F5B1EEAF0EAD15CD00B087B5 ToolbarConfiguration xcode.toolbar.config.buildAndRun @@ -850,7 +861,7 @@ /Users/xx/Grafx2/Grafx2.xcodeproj WindowString - 23 92 1000 639 0 0 1024 746 + 22 503 975 239 0 0 1024 746 WindowTools diff --git a/divers.c b/divers.c index 016e6c57..3a786057 100644 --- a/divers.c +++ b/divers.c @@ -85,7 +85,8 @@ void Set_palette(T_Palette Palette) PaletteSDL[i].g=(Palette[i].V<<2) + (Palette[i].V>>4); PaletteSDL[i].b=(Palette[i].B<<2) + (Palette[i].B>>4); } - SDL_SetPalette(Ecran_SDL,SDL_PHYSPAL|SDL_LOGPAL,PaletteSDL,0,256); + //SDL_PHYSPAL| + SDL_SetPalette(Ecran_SDL,SDL_LOGPAL,PaletteSDL,0,256); } void Attendre_fin_de_click(void) @@ -333,10 +334,8 @@ void Get_input(void) Afficher_curseur(); } - // Vidage de toute mise à jour qui serait encore en attente. - Flush_update(); - //SDL_Flip(Ecran_SDL); - + // Vidage de toute mise à jour qui serait encore en attente. + Flush_update(); } @@ -795,7 +794,7 @@ void Set_color(byte Couleur, byte Rouge, byte Vert, byte Bleu) comp.r=Rouge << 2; comp.g=Vert << 2; comp.b=Bleu << 2; - SDL_SetColors(Ecran_SDL,&comp,Couleur,1); + SDL_SetPalette(Ecran_SDL, SDL_LOGPAL, &comp, Couleur, 1); } void Scroll_picture(short Decalage_X,short Decalage_Y) diff --git a/palette.c b/palette.c index 33b90b92..c1e95a76 100644 --- a/palette.c +++ b/palette.c @@ -218,16 +218,14 @@ void Swap(int X_Swap,short Debut_Bloc_1,short Debut_Bloc_2,short Taille_du_bloc, dword Tempo; byte Table_de_conversion[256]; - struct Composantes * Palette_temporaire; - dword * Utilisation_temporaire; + struct Composantes Palette_temporaire[256]; + dword Utilisation_temporaire[256]; // On fait une copie de la palette - Palette_temporaire=(struct Composantes *)malloc(sizeof(T_Palette)); - memcpy(Palette_temporaire,Palette,sizeof(T_Palette)); + memcpy(Palette_temporaire, Palette, sizeof(T_Palette)); // On fait une copie de la table d'utilisation des couleurs - Utilisation_temporaire=(dword *)malloc(sizeof(dword)*256); - memcpy(Utilisation_temporaire,Utilisation_couleur,sizeof(dword)*256); + memcpy(Utilisation_temporaire, Utilisation_couleur, sizeof(dword) * 256); // On commence à initialiser la table de conversion à un état où elle ne // fera aucune conversion. @@ -312,9 +310,6 @@ void Swap(int X_Swap,short Debut_Bloc_1,short Debut_Bloc_2,short Taille_du_bloc, } } - free(Utilisation_temporaire); - free(Palette_temporaire); - // Maintenant, tous ces calculs doivent êtres pris en compte dans la // palette, l'image et à l'écran. Set_palette(Palette); @@ -797,7 +792,7 @@ void Bouton_Palette(void) Fenetre_Definir_bouton_saisie(263,39,3); // 23 Fenetre_Definir_bouton_normal(96,32,29,14,"HSV" ,1,1,SDLK_n); // 24 - Fenetre_Definir_bouton_normal(96,47,29,14,"Sort" ,1,1,SDLK_o); // 25 + Fenetre_Definir_bouton_normal(96,47,29,14,"Srt" ,1,1,SDLK_o); // 25 // Affichage du facteur de réduction de la palette Num2str(Reduce_Nb_couleurs,Chaine,3); Print_dans_fenetre(265,41,Chaine,CM_Noir,CM_Clair); @@ -978,6 +973,7 @@ void Bouton_Palette(void) Il_faut_remapper=1; Afficher_curseur(); + break; case 3 : // Jauge verte Effacer_curseur(); diff --git a/readline.c b/readline.c index 61aa7d75..7ea57030 100644 --- a/readline.c +++ b/readline.c @@ -43,6 +43,8 @@ #define COULEUR_TEXTE_CURSEUR CM_Noir #define COULEUR_FOND_CURSEUR CM_Fonce +extern int Update_necessaire; + // Suppresion d'un caractère à une certaine POSITION dans une CHAINE. void Supprimer_caractere(char * Chaine, byte Position) { @@ -157,6 +159,7 @@ byte Readline(word Pos_X,word Pos_Y,char * Chaine,byte Taille_affichee,byte Type Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3)); #ifdef __macosx__ + Update_necessaire = 1; Flush_update(); #endif @@ -300,9 +303,12 @@ affichage: UpdateRect(Fenetre_Pos_X+(Pos_X*Menu_Facteur_X),Fenetre_Pos_Y+(Pos_Y*Menu_Facteur_Y), Taille_affichee*(Menu_Facteur_X<<3),(Menu_Facteur_Y<<3)); } // Fin du "switch(Touche_lue)" + #ifdef __macosx__ + Update_necessaire = 1; Flush_update(); #endif + } // Fin du "while" // Effacement de la chaîne diff --git a/sdlscreen.c b/sdlscreen.c index 18a97d32..bf229eb1 100644 --- a/sdlscreen.c +++ b/sdlscreen.c @@ -507,14 +507,14 @@ short Max_Y=10000; void Flush_update(void) { - #if (METHODE_UPDATE == METHODE_UPDATE_PLEINE_PAGE) +#if (METHODE_UPDATE == METHODE_UPDATE_PLEINE_PAGE) // Mise à jour de la totalité de l'écran if (Update_necessaire) { SDL_UpdateRect(Ecran_SDL, 0, 0, 0, 0); Update_necessaire=0; } - #endif +#endif #if (METHODE_UPDATE == METHODE_UPDATE_PAR_CUMUL) if (Min_X>=Max_X || Min_Y>=Max_Y) {