Commit 825c0f71 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

fixed initialisation of pixel regions (bug #488845).

2007-10-22  Sven Neumann  <sven@gimp.org>

	* plug-ins/gflare/gflare.c (plugin_do_non_asupsample): fixed
	initialisation of pixel regions (bug #488845).

svn path=/trunk/; revision=23905
parent 8436366d
2007-10-22 Sven Neumann <sven@gimp.org>
* plug-ins/gflare/gflare.c (plugin_do_non_asupsample): fixed
initialisation of pixel regions (bug #488845).
2007-10-22 Sven Neumann <sven@gimp.org> 2007-10-22 Sven Neumann <sven@gimp.org>
* plug-ins/gflare/gflare.c: formatting. * plug-ins/gflare/gflare.c: formatting.
...@@ -1017,49 +1017,55 @@ plugin_do_non_asupsample (void) ...@@ -1017,49 +1017,55 @@ plugin_do_non_asupsample (void)
{ {
GimpPixelRgn src_rgn, dest_rgn; GimpPixelRgn src_rgn, dest_rgn;
gpointer pr; gpointer pr;
guchar *src_row; gint width, height;
guchar *dest_row;
guchar *src;
guchar *dest;
gint row, col;
gint x, y;
gint b;
gint progress, max_progress; gint progress, max_progress;
guchar src_pix[4];
guchar dest_pix[4]; width = dinfo.x2 - dinfo.x1;
height = dinfo.y2 - dinfo.y1;
progress = 0; progress = 0;
max_progress = (dinfo.x2 - dinfo.x1) * (dinfo.y2 - dinfo.y1); max_progress = width * height;
gimp_pixel_rgn_init (&src_rgn, drawable, gimp_pixel_rgn_init (&src_rgn, drawable,
dinfo.x1, dinfo.y1, dinfo.x2, dinfo.y2, FALSE, FALSE); dinfo.x1, dinfo.y1, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&dest_rgn, drawable, gimp_pixel_rgn_init (&dest_rgn, drawable,
dinfo.x1, dinfo.y1, dinfo.x2, dinfo.y2, TRUE, TRUE); dinfo.x1, dinfo.y1, width, height, TRUE, TRUE);
for (pr = gimp_pixel_rgns_register (2, &src_rgn, &dest_rgn); for (pr = gimp_pixel_rgns_register (2, &src_rgn, &dest_rgn);
pr != NULL; pr = gimp_pixel_rgns_process (pr)) pr != NULL; pr = gimp_pixel_rgns_process (pr))
{ {
src_row = src_rgn.data; const guchar *src_row = src_rgn.data;
dest_row = dest_rgn.data; guchar *dest_row = dest_rgn.data;
gint row, y;
for (row = 0, y = src_rgn.y; row < src_rgn.h; row++, y++) for (row = 0, y = src_rgn.y; row < src_rgn.h; row++, y++)
{ {
src = src_row; const guchar *src = src_row;
dest = dest_row; guchar *dest = dest_row;
gint col, x;
for (col = 0, x = src_rgn.x; col < src_rgn.w; col++, x++) for (col = 0, x = src_rgn.x; col < src_rgn.w; col++, x++)
{ {
guchar src_pix[4];
guchar dest_pix[4];
gint b;
for (b = 0; b < 3; b++) for (b = 0; b < 3; b++)
src_pix[b] = dinfo.is_color ? src[b] : src[0]; src_pix[b] = dinfo.is_color ? src[b] : src[0];
src_pix[3] = dinfo.has_alpha ? src[src_rgn.bpp - 1] : OPAQUE; src_pix[3] = dinfo.has_alpha ? src[src_rgn.bpp - 1] : OPAQUE;
calc_gflare_pix (dest_pix, x, y, src_pix); calc_gflare_pix (dest_pix, x, y, src_pix);
if (dinfo.is_color) if (dinfo.is_color)
for (b = 0; b < 3; b++) {
dest[b] = dest_pix[b]; for (b = 0; b < 3; b++)
dest[b] = dest_pix[b];
}
else else
dest[0] = LUMINOSITY (dest_pix); {
dest[0] = LUMINOSITY (dest_pix);
}
if (dinfo.has_alpha) if (dinfo.has_alpha)
dest[src_rgn.bpp - 1] = dest_pix[3]; dest[src_rgn.bpp - 1] = dest_pix[3];
...@@ -1067,9 +1073,11 @@ plugin_do_non_asupsample (void) ...@@ -1067,9 +1073,11 @@ plugin_do_non_asupsample (void)
src += src_rgn.bpp; src += src_rgn.bpp;
dest += dest_rgn.bpp; dest += dest_rgn.bpp;
} }
src_row += src_rgn.rowstride; src_row += src_rgn.rowstride;
dest_row += dest_rgn.rowstride; dest_row += dest_rgn.rowstride;
} }
/* Update progress */ /* Update progress */
progress += src_rgn.w * src_rgn.h; progress += src_rgn.w * src_rgn.h;
gimp_progress_update ((double) progress / (double) max_progress); gimp_progress_update ((double) progress / (double) max_progress);
......
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