Fix part of issue 459: In anim mode, Color-replacer didn't refresh the screen

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1943 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2012-04-08 14:45:56 +00:00
parent 020e57846b
commit 064bbebc5b
4 changed files with 16 additions and 28 deletions

View File

@ -2693,7 +2693,7 @@ void Polyfill(int vertices, short * points, int color)
//------------ Remplacement de la couleur pointée par une autre --------------
void Replace(byte New_color)
void Replace(byte new_color)
{
byte old_color;
@ -2701,11 +2701,17 @@ void Replace(byte New_color)
&& (Paintbrush_Y<Main_image_height))
{
old_color=Read_pixel_from_current_layer(Paintbrush_X,Paintbrush_Y);
if ( (old_color!=New_color)
if ( (old_color!=new_color)
&& ((!Stencil_mode) || (!Stencil[old_color])) )
{
Replace_a_color(old_color,New_color);
Display_all_screen();
word x;
word y;
// Update all pixels
for (y=0; y<Main_image_height; y++)
for (x=0; x<Main_image_width; x++)
if (Read_pixel_from_current_layer(x,y) == old_color)
Pixel_in_current_screen(x,y,new_color);
}
}
}

View File

@ -229,21 +229,6 @@ byte Read_pixel_from_brush (word x, word y)
return *(Brush + y * Brush_width + x);
}
void Replace_a_color(byte old_color, byte new_color)
{
word x;
word y;
// Update all pixels
for (y=0; y<Main_image_height; y++)
for (x=0; x<Main_image_width; x++)
if (Read_pixel_from_current_layer(x,y) == old_color)
Pixel_in_current_screen(x,y,new_color);
Update_rect(0,0,0,0); // On peut TOUT a jour
// C'est pas un problème car il n'y a pas de preview
}
// FIXME: move to graph.c, it's the only caller
void Ellipse_compute_limites(short horizontal_radius,short vertical_radius)
{
Ellipse_horizontal_radius_squared =

View File

@ -79,7 +79,6 @@ byte Pixel_in_circle(void);
void Init_chrono(dword delay);
void Check_timer(void);
void Replace_a_color(byte old_color, byte New_color);
void Replace_colors_within_limits(byte * replace_table);
byte Effect_interpolated_colorize (word x,word y,byte color);

View File

@ -1365,14 +1365,13 @@ void Replace_1_0(void)
//
{
Hide_cursor();
// Pas besoin d'initialiser le début d'opération car le Smear n'affecte pas
// le Replace, et on se fout de savoir si on est dans la partie gauche ou
// droite de la loupe.
Init_start_operation();
Backup();
// Shade_table=Shade_table_left;
Replace(Fore_color);
Display_cursor();
End_of_modification();
Display_all_screen();
Display_cursor();
Wait_end_of_click();
}
@ -1390,14 +1389,13 @@ void Replace_2_0(void)
return;
Hide_cursor();
// Pas besoin d'initialiser le début d'opération car le Smear n'affecte pas
// le Replace, et on se fout de savoir si on est dans la partie gauche ou
// droite de la loupe.
Init_start_operation();
Backup();
// Shade_table=Shade_table_right;
Replace(Back_color);
Display_cursor();
End_of_modification();
Display_all_screen();
Display_cursor();
Wait_end_of_click();
}