Bug 573488 – Small bug in Filter>Distorts>Ripple

2009-02-28  Sven Neumann  <sven@gimp.org>

	Bug 573488 – Small bug in Filter>Distorts>Ripple

	* plug-ins/common/ripple.c (ripple_vertical): fixed bug spotted 
in
	SMEAR mode, pointed out by Andreas Groth.


svn path=/trunk/; revision=28079
This commit is contained in:
Sven Neumann 2009-02-28 17:32:20 +00:00 committed by Sven Neumann
parent a586ea03fa
commit e93e0b2543
3 changed files with 24 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2009-02-28 Sven Neumann <sven@gimp.org>
Bug 573488 Small bug in Filter>Distorts>Ripple
* plug-ins/common/ripple.c (ripple_vertical): fixed bug spotted in
SMEAR mode, pointed out by Andreas Groth.
2009-02-28 Sven Neumann <sven@gimp.org> 2009-02-28 Sven Neumann <sven@gimp.org>
Bug 520078 Rotate brushes Bug 520078 Rotate brushes

View File

@ -308,6 +308,8 @@ run (const gchar *name,
values[1].data.d_string = error->message; values[1].data.d_string = error->message;
} }
g_printerr ("%s status: %d\n", G_STRFUNC, status);
values[0].data.d_status = status; values[0].data.d_status = status;
} }

View File

@ -260,7 +260,7 @@ ripple_vertical (gint x,
gint bpp, gint bpp,
gpointer data) gpointer data)
{ {
RippleParam_t *param = (RippleParam_t*) data; RippleParam_t *param = data;
GimpPixelFetcher *pft; GimpPixelFetcher *pft;
guchar pixel[2][4]; guchar pixel[2][4];
gdouble needy; gdouble needy;
@ -270,26 +270,30 @@ ripple_vertical (gint x,
height = param->height; height = param->height;
needy = y + displace_amount(x); needy = y + displace_amount(x);
yi = floor(needy); yi = floor (needy);
yi_a = yi+1; yi_a = yi + 1;
/* Tile the image. */ /* Tile the image. */
if (rvals.edges == WRAP) if (rvals.edges == WRAP)
{ {
needy = fmod(needy, height); needy = fmod(needy, height);
if (needy < 0.0) if (needy < 0.0)
needy += height; needy += height;
yi = (yi % height);
yi = yi % height;
if (yi < 0) if (yi < 0)
yi += height; yi += height;
yi_a = (yi+1) % height;
yi_a = yi_a % height;
} }
/* Smear out the edges of the image by repeating pixels. */ /* Smear out the edges of the image by repeating pixels. */
else if (rvals.edges == SMEAR) else if (rvals.edges == SMEAR)
{ {
needy= CLAMP (needy , 0, height - 1); needy = CLAMP (needy, 0, height - 1);
yi = CLAMP (yi , 0, height - 1); yi = CLAMP (yi , 0, height - 1);
yi_a = CLAMP (yi_a + 1, 0, height - 1); yi_a = CLAMP (yi_a , 0, height - 1);
} }
if (rvals.antialias) if (rvals.antialias)
@ -301,16 +305,16 @@ ripple_vertical (gint x,
if (yi_a >=0 && yi_a < height) if (yi_a >=0 && yi_a < height)
gimp_pixel_fetcher_get_pixel (pft, x, yi_a, pixel[1]); gimp_pixel_fetcher_get_pixel (pft, x, yi_a, pixel[1]);
else else
memset(pixel[1], 0, 4); memset (pixel[1], 0, 4);
average_two_pixels (dest, pixel, needy - yi, bpp, param->has_alpha); average_two_pixels (dest, pixel, needy - yi, bpp, param->has_alpha);
} /* antialias */ } /* antialias */
else else
{ {
if (yi >=0 && yi < height) if (yi >= 0 && yi < height)
gimp_pixel_fetcher_get_pixel (pft, x, yi, dest); gimp_pixel_fetcher_get_pixel (pft, x, yi, dest);
else else
memset(dest, 0, bpp); memset (dest, 0, bpp);
} }
} }