make sure we don't get stuck in a loop if all pixels are transparent (bug

2007-11-16  Sven Neumann  <sven@gimp.org>

	* app/base/lut-funcs.c (equalize_lut_setup): make sure we don't
	get stuck in a loop if all pixels are transparent (bug #497291).

svn path=/trunk/; revision=24172
This commit is contained in:
Sven Neumann 2007-11-16 13:47:28 +00:00 committed by Sven Neumann
parent 52581ec851
commit b9973273dd
2 changed files with 17 additions and 15 deletions

View File

@ -1,3 +1,8 @@
2007-11-16 Sven Neumann <sven@gimp.org>
* app/base/lut-funcs.c (equalize_lut_setup): make sure we don't
get stuck in a loop if all pixels are transparent (bug #497291).
2007-11-16 Sven Neumann <sven@gimp.org> 2007-11-16 Sven Neumann <sven@gimp.org>
* libgimpconfig/gimpcolorconfig.c: changed default value for using * libgimpconfig/gimpcolorconfig.c: changed default value for using

View File

@ -74,8 +74,8 @@ brightness_contrast_lut_setup (GimpLut *lut,
data.brightness = brightness; data.brightness = brightness;
data.contrast = contrast; data.contrast = contrast;
gimp_lut_setup (lut, (GimpLutFunc) brightness_contrast_lut_func, gimp_lut_setup (lut,
(gpointer) &data, n_channels); (GimpLutFunc) brightness_contrast_lut_func, &data, n_channels);
} }
GimpLut * GimpLut *
@ -111,8 +111,7 @@ invert_lut_setup (GimpLut *lut,
{ {
g_return_if_fail (lut != NULL); g_return_if_fail (lut != NULL);
gimp_lut_setup_exact (lut, (GimpLutFunc) invert_lut_func, gimp_lut_setup_exact (lut, (GimpLutFunc) invert_lut_func, NULL, n_channels);
NULL , n_channels);
} }
GimpLut * GimpLut *
@ -147,8 +146,7 @@ add_lut_setup (GimpLut *lut,
{ {
g_return_if_fail (lut != NULL); g_return_if_fail (lut != NULL);
gimp_lut_setup (lut, (GimpLutFunc) add_lut_func, gimp_lut_setup (lut, (GimpLutFunc) add_lut_func, &amount, n_channels);
(gpointer) &amount, n_channels);
} }
GimpLut * GimpLut *
@ -184,8 +182,8 @@ intersect_lut_setup (GimpLut *lut,
{ {
g_return_if_fail (lut != NULL); g_return_if_fail (lut != NULL);
gimp_lut_setup_exact (lut, (GimpLutFunc) intersect_lut_func, gimp_lut_setup_exact (lut,
(gpointer) &value , n_channels); (GimpLutFunc) intersect_lut_func, &value, n_channels);
} }
GimpLut * GimpLut *
@ -224,8 +222,8 @@ threshold_lut_setup (GimpLut *lut,
{ {
g_return_if_fail (lut != NULL); g_return_if_fail (lut != NULL);
gimp_lut_setup_exact (lut, (GimpLutFunc) threshold_lut_func, gimp_lut_setup_exact (lut,
(gpointer) &value , n_channels); (GimpLutFunc) threshold_lut_func, &value, n_channels);
} }
GimpLut * GimpLut *
@ -270,8 +268,8 @@ posterize_lut_setup (GimpLut *lut,
{ {
g_return_if_fail (lut != NULL); g_return_if_fail (lut != NULL);
gimp_lut_setup_exact (lut, (GimpLutFunc) posterize_lut_func, gimp_lut_setup_exact (lut,
(gpointer) &levels, n_channels); (GimpLutFunc) posterize_lut_func, &levels, n_channels);
} }
GimpLut * GimpLut *
@ -344,7 +342,7 @@ equalize_lut_setup (GimpLut *lut,
{ {
desired = i * pixels_per_value; desired = i * pixels_per_value;
while (sum <= desired) while (sum < desired && j < 256)
{ {
j++; j++;
sum += gimp_histogram_get_channel (hist, k, j + 1); sum += gimp_histogram_get_channel (hist, k, j + 1);
@ -360,8 +358,7 @@ equalize_lut_setup (GimpLut *lut,
} }
} }
gimp_lut_setup (lut, (GimpLutFunc) equalize_lut_func, gimp_lut_setup (lut, (GimpLutFunc) equalize_lut_func, &hlut, n_channels);
(gpointer) &hlut, n_channels);
} }
GimpLut * GimpLut *