app/gimage.c Invalidate the color_hash_table used for rgb->indexed

* app/gimage.c
 * app/paint_funcs.[ch]: Invalidate the color_hash_table used
   for rgb->indexed conversions if the colormap of the indexed
   image changes. Fixes bug #2683.

--Sven
This commit is contained in:
Sven Neumann 2000-02-10 21:38:43 +00:00
parent 1b0928ec7b
commit 4490df9145
6 changed files with 77 additions and 14 deletions

View File

@ -1,3 +1,10 @@
Thu Feb 10 17:20:05 CET 2000 Sven Neumann <sven@gimp.org>
* app/gimage.c
* app/paint_funcs.[ch]: Invalidate the color_hash_table used
for rgb->indexed conversions if the colormap of the indexed
image changes. Fixes bug #2683.
Thu Feb 10 15:43:02 CET 2000 Sven Neumann <sven@gimp.org>
* app/edit_selection.c: fixed bug #6092.
@ -8,8 +15,7 @@ Thu Feb 10 15:20:13 CET 2000 Sven Neumann <sven@gimp.org>
guides again. Layer moves are slightly faster than before, if no
guides are present.
* app/gdisplay.c
* app/gdisplay.h
* app/gdisplay.[ch]
* app/gdisplayP.h: Use doubles for snap_to_point. Less rounding
makes the result much better on low resolution. If it snaps, the
result should be exactly the guide in almost all cases now. Only

View File

@ -166,6 +166,9 @@ gimage_cmap_change_handler (GimpImage *gimage,
gpointer user_data)
{
gdisplays_update_full (gimage);
if (gimp_image_base_type (gimage) == INDEXED)
paint_funcs_invalidate_color_hash_table (gimage, ncol);
}
static void

View File

@ -128,15 +128,17 @@ static void run_length_encode (unsigned char *, int *, int, int);
static void draw_segments (PixelRegion *, BoundSeg *, int, int, int, int);
#endif
static double cubic (double, int, int, int, int);
static void apply_layer_mode_replace (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int, int,
int, int, int, int *);
static void rotate_pointers(void **p, guint32 n);
static void apply_layer_mode_replace (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int, int,
int, int, int, int *);
static void rotate_pointers (void **p, guint32 n);
void
update_tile_rowhints (Tile* tile, int ymin, int ymax)
update_tile_rowhints (Tile *tile,
int ymin,
int ymax)
{
int bpp, ewidth, eheight;
int x,y;
@ -585,6 +587,29 @@ paint_funcs_free ()
*/
}
void
paint_funcs_invalidate_color_hash_table (GimpImage* gimage,
gint index)
{
gint i;
g_return_if_fail (gimage != NULL);
if (index == -1) /* invalidate all entries */
{
for (i = 0; i < HASH_TABLE_SIZE; i++)
if (color_hash_table[i].gimage == gimage)
color_hash_table[i].gimage = NULL;
}
else
{
for (i = 0; i < HASH_TABLE_SIZE; i++)
if (color_hash_table[i].gimage == gimage &&
color_hash_table[i].index == index)
color_hash_table[i].gimage = NULL;
}
}
void
color_pixels (unsigned char *dest,

View File

@ -32,6 +32,8 @@
void paint_funcs_setup (void);
void paint_funcs_free (void);
void paint_funcs_invalidate_color_hash_table (GimpImage* gimage,
gint index);
/* Paint functions */

View File

@ -128,15 +128,17 @@ static void run_length_encode (unsigned char *, int *, int, int);
static void draw_segments (PixelRegion *, BoundSeg *, int, int, int, int);
#endif
static double cubic (double, int, int, int, int);
static void apply_layer_mode_replace (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int, int,
int, int, int, int *);
static void rotate_pointers(void **p, guint32 n);
static void apply_layer_mode_replace (unsigned char *, unsigned char *,
unsigned char *, unsigned char *,
int, int, int,
int, int, int, int *);
static void rotate_pointers (void **p, guint32 n);
void
update_tile_rowhints (Tile* tile, int ymin, int ymax)
update_tile_rowhints (Tile *tile,
int ymin,
int ymax)
{
int bpp, ewidth, eheight;
int x,y;
@ -585,6 +587,29 @@ paint_funcs_free ()
*/
}
void
paint_funcs_invalidate_color_hash_table (GimpImage* gimage,
gint index)
{
gint i;
g_return_if_fail (gimage != NULL);
if (index == -1) /* invalidate all entries */
{
for (i = 0; i < HASH_TABLE_SIZE; i++)
if (color_hash_table[i].gimage == gimage)
color_hash_table[i].gimage = NULL;
}
else
{
for (i = 0; i < HASH_TABLE_SIZE; i++)
if (color_hash_table[i].gimage == gimage &&
color_hash_table[i].index == index)
color_hash_table[i].gimage = NULL;
}
}
void
color_pixels (unsigned char *dest,

View File

@ -32,6 +32,8 @@
void paint_funcs_setup (void);
void paint_funcs_free (void);
void paint_funcs_invalidate_color_hash_table (GimpImage* gimage,
gint index);
/* Paint functions */