From d9cc87b669970dde0cc12fc9a9c8dfe94c31382e Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 10 Aug 2008 13:18:58 +0000 Subject: [PATCH] Set_color did not divide colors by 4 for VGAcompatibility git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@115 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- divers.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/divers.c b/divers.c index ead6c387..abd3a706 100644 --- a/divers.c +++ b/divers.c @@ -484,9 +484,23 @@ void Rotate_90_deg_LOWLEVEL(byte * Source,byte * Destination) } } +// Remplacer une couleur par une autre dans un buffer + void Remap_general_LOWLEVEL(byte * Table_conv,byte * Buffer,short Largeur,short Hauteur,short Largeur_buffer) { - UNIMPLEMENTED + int dx,cx; + + // Pour chaque ligne + for(dx=Hauteur;dx>0;dx--) + { + // Pour chaque pixel + for(cx=Largeur;cx>0;cx--) + { + *Buffer = Table_conv[*Buffer]; + Buffer++; + } + Buffer += Largeur_buffer-Largeur; + } } void Copier_image_dans_brosse(short Debut_X,short Debut_Y,short Brosse_Largeur,short Brosse_Hauteur,word Largeur_image) @@ -779,9 +793,9 @@ byte Meilleure_couleur_sans_exclusion(byte Rouge,byte Vert,byte Bleu) void Set_color(byte Couleur, byte Rouge, byte Vert, byte Bleu) { SDL_Color comp; - comp.r=Rouge; - comp.g=Vert; - comp.b=Bleu; + comp.r=Rouge << 2; + comp.g=Vert << 2; + comp.b=Bleu << 2; SDL_SetColors(Ecran_SDL,&comp,Couleur,1); }