Improved display of Statistics window. Corrected color counting function
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@57 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
b184c1ca0f
commit
b458b4787e
34
aide.c
34
aide.c
@ -199,8 +199,8 @@ void Bouton_Stats(void)
|
||||
short Bouton_clicke;
|
||||
char Buffer[37];
|
||||
dword Utilisation_couleur[256];
|
||||
long Taille;
|
||||
struct statfs* Informations_Disque = NULL;
|
||||
unsigned long long Taille;
|
||||
struct statfs Informations_Disque;
|
||||
|
||||
|
||||
Ouvrir_fenetre(310,174,"Statistics");
|
||||
@ -220,25 +220,32 @@ void Bouton_Stats(void)
|
||||
|
||||
// Affichage de la mémoire restante
|
||||
Print_dans_fenetre(10,35,"Free memory:",STATS_COULEUR_TITRES,CM_Noir);
|
||||
unsigned long freeRam = Memoire_libre();
|
||||
if(freeRam > (1024*1024*1024))
|
||||
sprintf(Buffer,"%ld Gigabytes",freeRam/(1024*1024*1024));
|
||||
else if(freeRam > (1024*1024))
|
||||
sprintf(Buffer,"%ld Megabytes",freeRam/(1024*1024));
|
||||
else if(freeRam > 1024)
|
||||
sprintf(Buffer,"%ld Kilobytes",freeRam/1024);
|
||||
unsigned long long freeRam = Memoire_libre();
|
||||
if(freeRam > (100ULL*1024*1024*1024))
|
||||
sprintf(Buffer,"%d Gigabytes",(unsigned int)(freeRam/(1024*1024*1024)));
|
||||
else if(freeRam > (100*1024*1024))
|
||||
sprintf(Buffer,"%d Megabytes",(unsigned int)(freeRam/(1024*1024)));
|
||||
else if(freeRam > 100*1024)
|
||||
sprintf(Buffer,"%d Kilobytes",(unsigned int)(freeRam/1024));
|
||||
else
|
||||
sprintf(Buffer,"%ld bytes",freeRam);
|
||||
sprintf(Buffer,"%d bytes",(unsigned int)freeRam);
|
||||
Print_dans_fenetre(114,35,Buffer,STATS_COULEUR_DONNEES,CM_Noir);
|
||||
|
||||
// Affichage de l'espace disque libre
|
||||
sprintf(Buffer,"Free space on %c:",Principal_Repertoire_courant[0]);
|
||||
Print_dans_fenetre(10,51,Buffer,STATS_COULEUR_TITRES,CM_Noir);
|
||||
statfs(Principal_Repertoire_courant,Informations_Disque);
|
||||
Taille=Informations_Disque->f_bfree;
|
||||
statfs(Principal_Repertoire_courant,&Informations_Disque);
|
||||
Taille=Informations_Disque.f_bfree * Informations_Disque.f_bsize;
|
||||
if (Taille>=0)
|
||||
{
|
||||
sprintf(Buffer,"%ld bytes",Taille);
|
||||
if(Taille > (100ULL*1024*1024*1024))
|
||||
sprintf(Buffer,"%d Gigabytes",(unsigned int)(Taille/(1024*1024*1024)));
|
||||
else if(Taille > (100*1024*1024))
|
||||
sprintf(Buffer,"%d Megabytes",(unsigned int)(Taille/(1024*1024)));
|
||||
else if(Taille > (100*1024))
|
||||
sprintf(Buffer,"%d Kilobytes",(unsigned int)(Taille/1024));
|
||||
else
|
||||
sprintf(Buffer,"%d bytes",(unsigned int)Taille);
|
||||
Print_dans_fenetre(146,51,Buffer,STATS_COULEUR_DONNEES,CM_Noir);
|
||||
}
|
||||
else
|
||||
@ -254,6 +261,7 @@ void Bouton_Stats(void)
|
||||
|
||||
// Affichage du nombre de couleur utilis‚
|
||||
Print_dans_fenetre(18,83,"Colors used:",STATS_COULEUR_TITRES,CM_Noir);
|
||||
bzero(Utilisation_couleur,256*sizeof(Utilisation_couleur[0]));
|
||||
sprintf(Buffer,"%d",Palette_Compter_nb_couleurs_utilisees(Utilisation_couleur));
|
||||
Print_dans_fenetre(122,83,Buffer,STATS_COULEUR_DONNEES,CM_Noir);
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ void Bouton_Message_initial(void)
|
||||
Print_char_transparent_dans_fenetre(63,119,'S',CM_Noir);
|
||||
Print_char_transparent_dans_fenetre(74,120,'T',CM_Noir);
|
||||
}
|
||||
SDL_UpdateRect(Ecran_SDL,(Largeur_ecran-(260*Menu_Facteur_X))>>1,(Hauteur_ecran-(172*Menu_Facteur_Y))>>1,260,172);
|
||||
SDL_UpdateRect(Ecran_SDL,(Largeur_ecran-(260*Menu_Facteur_X))>>1,(Hauteur_ecran-(172*Menu_Facteur_Y))>>1,260*Menu_Facteur_X,172*Menu_Facteur_Y);
|
||||
Fenetre_Definir_bouton_normal(90,151,80,14,"OK",0,1,0x001C); // 1
|
||||
|
||||
Afficher_curseur();
|
||||
|
||||
11
divers.c
11
divers.c
@ -15,7 +15,7 @@ byte Recuperer_nb_lignes(void)
|
||||
word Palette_Compter_nb_couleurs_utilisees(dword* Tableau)
|
||||
{
|
||||
int Nombre_De_Pixels=0;
|
||||
Uint8* Pixel_Courant=Ecran;
|
||||
Uint8* Pixel_Courant=Principal_Ecran;
|
||||
Uint8 Couleur;
|
||||
word Nombre_Couleurs=0;
|
||||
int i;
|
||||
@ -24,7 +24,7 @@ word Palette_Compter_nb_couleurs_utilisees(dword* Tableau)
|
||||
Nombre_De_Pixels=Principal_Hauteur_image*Principal_Largeur_image;
|
||||
|
||||
// On parcourt l'écran courant pour compter les utilisations des couleurs
|
||||
for(i=0;i>Nombre_De_Pixels;i++)
|
||||
for(i=0;i<Nombre_De_Pixels;i++)
|
||||
{
|
||||
Couleur=*Pixel_Courant; //on lit la couleur dans l'écran
|
||||
|
||||
@ -35,14 +35,11 @@ word Palette_Compter_nb_couleurs_utilisees(dword* Tableau)
|
||||
}
|
||||
|
||||
//On va maintenant compter dans la table les couleurs utilisées:
|
||||
Couleur=0;
|
||||
do
|
||||
for(i=0;i<256;i++)
|
||||
{
|
||||
if (Tableau[Couleur]!=0)
|
||||
if (Tableau[i]!=0)
|
||||
Nombre_Couleurs++;
|
||||
Couleur++;
|
||||
}
|
||||
while(Couleur!=0); //On sort quand on a fait le tour (la var est sur 8 bits donc 255+1=0)
|
||||
|
||||
return Nombre_Couleurs;
|
||||
}
|
||||
|
||||
9
graph.c
9
graph.c
@ -1670,10 +1670,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
|
||||
&& (Pinceau_Y<=Limite_Bas) )
|
||||
Pixel_Preview(Pinceau_X,Pinceau_Y,Couleur);
|
||||
|
||||
// UpdateRect
|
||||
SDL_UpdateRect(Ecran_SDL,Pinceau_X,Pinceau_Y,
|
||||
1,1
|
||||
);
|
||||
SDL_UpdateRect(Ecran_SDL, Pinceau_X, Pinceau_Y, 1,1 );
|
||||
break;
|
||||
|
||||
case FORME_PINCEAU_BROSSE_COULEUR : // Brosse en couleur
|
||||
@ -1820,8 +1817,6 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
|
||||
Back_color,Fore_color,
|
||||
Brosse_Largeur);
|
||||
|
||||
// UPDATERECT ds FCT
|
||||
|
||||
if (Loupe_Mode)
|
||||
{
|
||||
Calculer_dimensions_clipees_zoom(&Debut_X,&Debut_Y,&Largeur,&Hauteur);
|
||||
@ -1929,8 +1924,6 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
|
||||
0,Fore_color,
|
||||
TAILLE_MAXI_PINCEAU);
|
||||
|
||||
// UPDATERECT ds FCT
|
||||
|
||||
if (Loupe_Mode)
|
||||
{
|
||||
Calculer_dimensions_clipees_zoom(&Debut_X,&Debut_Y,&Largeur,&Hauteur);
|
||||
|
||||
1
init.c
1
init.c
@ -70,6 +70,7 @@ word Drive_Touche[26]=
|
||||
0x0415,
|
||||
0x042C
|
||||
};
|
||||
|
||||
// Ajouter un lecteur à la liste de lecteurs
|
||||
void Ajouter_lecteur(byte Numero, byte Type)
|
||||
{
|
||||
|
||||
2
main.c
2
main.c
@ -23,7 +23,7 @@
|
||||
#include "sdlscreen.h"
|
||||
#include "erreurs.h"
|
||||
|
||||
byte Ancien_nb_lignes; // Ancien nombre de lignes de l'écran
|
||||
byte Ancien_nb_lignes; // Ancien nombre de lignes de l'écran
|
||||
|
||||
|
||||
//--- Affichage de la syntaxe, et de la liste des modes vidéos disponibles ---
|
||||
|
||||
10
sdlscreen.c
10
sdlscreen.c
@ -106,11 +106,15 @@ void Display_brush_Color_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Decala
|
||||
puts("Display_brush_Color_SDL non implémenté!");
|
||||
}
|
||||
|
||||
void Display_brush_Mono_SDL (word Pos_X,word Pos_Y,word Decalage_X,word Decalage_Y,word Largeur,word Hauteur,byte Couleur_de_transparence,byte Couleur,word Largeur_brosse)
|
||||
void Display_brush_Mono_SDL (word Pos_X, word Pos_Y,
|
||||
word Decalage_X, word Decalage_Y, word Largeur, word Hauteur,
|
||||
byte Couleur_de_transparence, byte Couleur, word Largeur_brosse)
|
||||
/* On affiche la brosse en monochrome */
|
||||
{
|
||||
byte* Dest=Pos_Y*Largeur_ecran+Pos_X+Ecran; //EDI=adr destination à l'écran
|
||||
byte* Src=Largeur_brosse*Decalage_Y+Decalage_X+Brosse; //ESI=adr ds la brosse
|
||||
byte* Dest=Pos_Y*Largeur_ecran+Pos_X+Ecran; // EDI = adr destination à
|
||||
// l'écran
|
||||
byte* Src=Largeur_brosse*Decalage_Y+Decalage_X+Brosse; // ESI = adr ds
|
||||
// la brosse
|
||||
int dx,cx;
|
||||
|
||||
for(dx=Hauteur;dx!=0;dx--)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user