Commit bd0ddb5b authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

applied patch from David Gowers (bug #359175) and did some further

2006-10-03  Sven Neumann  <sven@gimp.org>

	* app/core/gimpimage-convert.[ch]
	(gimp_image_convert_set_dither_matrix): applied patch from David
	Gowers (bug #359175) and did some further cleanup.
parent 76365b37
2006-10-03 Sven Neumann <sven@gimp.org>
* app/core/gimpimage-convert.[ch]
(gimp_image_convert_set_dither_matrix): applied patch from David
Gowers (bug #359175) and did some further cleanup.
2006-10-03 Sven Neumann <sven@gimp.org>
 
* plug-ins/common/iwarp.c (iwarp_dialog): use a GimpHintBox.
......
......@@ -4005,15 +4005,12 @@ delete_median_cut (QuantizeObj *quantobj)
void
gimp_image_convert_set_dither_matrix (gint width,
gint height,
guchar *source)
gimp_image_convert_set_dither_matrix (gint width,
gint height,
const guchar *source)
{
gint x;
gint y;
gint high_value;
gint tmp;
gfloat scale;
gint x;
gint y;
/* if source is invalid, restore the default matrix */
if (source == NULL || width == 0 || height == 0)
......@@ -4026,23 +4023,11 @@ gimp_image_convert_set_dither_matrix (gint width,
g_return_if_fail ((DM_WIDTH % width) == 0);
g_return_if_fail ((DM_HEIGHT % height) == 0);
/* find maximum value in input */
high_value = 0;
for (x = 0; x < (width * height); x++)
{
if (source[x] > high_value)
high_value = source[x];
}
scale = 255.0 / (float)high_value;
for (y = 0; y < DM_HEIGHT; y++)
{
for (x = 0; x < DM_WIDTH; x++)
{
tmp = source[((x % width) * height) + (y % height)];
DM[x][y] = (guchar) (ROUND((float)tmp * scale));
DM[x][y] = source[((x % width) * height) + (y % height)];
}
}
}
......
......@@ -36,9 +36,9 @@ void gimp_image_convert (GimpImage *image,
GimpPalette *custom_palette,
GimpProgress *progress);
void gimp_image_convert_set_dither_matrix (gint width,
gint height,
guchar *source);
void gimp_image_convert_set_dither_matrix (gint width,
gint height,
const guchar *source);
#endif /* __GIMP_IMAGE_CONVERT_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment