applied a patch by Gerald Friedland that changes the code to clear the

2005-11-04  Sven Neumann  <sven@gimp.org>

	* app/base/siox.c: applied a patch by Gerald Friedland that
	changes the code to clear the cache selectively instead of dumping
	it completely if the foreground or background area is changed.
This commit is contained in:
Sven Neumann 2005-11-04 20:00:38 +00:00 committed by Sven Neumann
parent a241bbc2b9
commit 2fb4908c40
2 changed files with 25 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2005-11-04 Sven Neumann <sven@gimp.org>
* app/base/siox.c: applied a patch by Gerald Friedland that
changes the code to clear the cache selectively instead of dumping
it completely if the foreground or background area is changed.
2005-11-04 Sven Neumann <sven@gimp.org>
* app/core/gimpenvirontable.c (gimp_environ_table_load_env_file):

View file

@ -698,15 +698,26 @@ siox_progress_update (SioxProgressFunc progress_callback,
progress_callback (progress_data, value);
}
/* Needed for clearing hashtable as defined by glib*/
/* Clear hashtable entries that get invalid due to refinement */
static gboolean
dummy_remove_hash (gpointer key,
gpointer value,
gpointer user_data)
siox_cache_remove_fg (gpointer key,
gpointer value,
gpointer user_data)
{
return TRUE;
classresult *cr = value;
return (cr->bgdist < cr->fgdist);
}
static gboolean
siox_cache_remove_bg (gpointer key,
gpointer value,
gpointer user_data)
{
classresult *cr = value;
return (cr->fgdist < cr->bgdist);
}
/**
* siox_init:
@ -845,7 +856,9 @@ siox_foreground_extract (SioxState *state,
SIOX_REFINEMENT_ADD_BACKGROUND))
{
g_hash_table_foreach_remove (state->cache,
(GHRFunc) dummy_remove_hash, NULL);
refinement & SIOX_REFINEMENT_ADD_FOREGROUND ?
siox_cache_remove_fg : siox_cache_remove_bg,
NULL);
/* count given foreground and background pixels */
pixel_region_init (&mapPR, mask, x, y, width, height, FALSE);