From e93e0b2543184512d43009b3c51132311561522d Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Sat, 28 Feb 2009 17:32:20 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20573488=20=E2=80=93=20Small=20bug=20in=20F?= =?UTF-8?q?ilter>Distorts>Ripple?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2009-02-28 Sven Neumann 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 --- ChangeLog | 7 +++++++ plug-ins/common/file-svg.c | 2 ++ plug-ins/common/ripple.c | 26 +++++++++++++++----------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 253ae3a92b..2342ee7134 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-02-28 Sven Neumann + + 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 Bug 520078 – Rotate brushes diff --git a/plug-ins/common/file-svg.c b/plug-ins/common/file-svg.c index b29bad9a35..64271b2cc2 100644 --- a/plug-ins/common/file-svg.c +++ b/plug-ins/common/file-svg.c @@ -308,6 +308,8 @@ run (const gchar *name, values[1].data.d_string = error->message; } + g_printerr ("%s status: %d\n", G_STRFUNC, status); + values[0].data.d_status = status; } diff --git a/plug-ins/common/ripple.c b/plug-ins/common/ripple.c index e9549a74b7..b8a1878e6f 100644 --- a/plug-ins/common/ripple.c +++ b/plug-ins/common/ripple.c @@ -260,7 +260,7 @@ ripple_vertical (gint x, gint bpp, gpointer data) { - RippleParam_t *param = (RippleParam_t*) data; + RippleParam_t *param = data; GimpPixelFetcher *pft; guchar pixel[2][4]; gdouble needy; @@ -270,26 +270,30 @@ ripple_vertical (gint x, height = param->height; needy = y + displace_amount(x); - yi = floor(needy); - yi_a = yi+1; + yi = floor (needy); + yi_a = yi + 1; /* Tile the image. */ if (rvals.edges == WRAP) { needy = fmod(needy, height); + if (needy < 0.0) needy += height; - yi = (yi % height); + + yi = yi % height; + if (yi < 0) yi += height; - yi_a = (yi+1) % height; + + yi_a = yi_a % height; } /* Smear out the edges of the image by repeating pixels. */ else if (rvals.edges == SMEAR) { - needy= CLAMP (needy , 0, height - 1); - yi = CLAMP (yi , 0, height - 1); - yi_a = CLAMP (yi_a + 1, 0, height - 1); + needy = CLAMP (needy, 0, height - 1); + yi = CLAMP (yi , 0, height - 1); + yi_a = CLAMP (yi_a , 0, height - 1); } if (rvals.antialias) @@ -301,16 +305,16 @@ ripple_vertical (gint x, if (yi_a >=0 && yi_a < height) gimp_pixel_fetcher_get_pixel (pft, x, yi_a, pixel[1]); else - memset(pixel[1], 0, 4); + memset (pixel[1], 0, 4); average_two_pixels (dest, pixel, needy - yi, bpp, param->has_alpha); } /* antialias */ else { - if (yi >=0 && yi < height) + if (yi >= 0 && yi < height) gimp_pixel_fetcher_get_pixel (pft, x, yi, dest); else - memset(dest, 0, bpp); + memset (dest, 0, bpp); } }