From e717e0731c807a84d7ccf33891fc7fc18fe3f862 Mon Sep 17 00:00:00 2001 From: Seth Burgess Date: Fri, 31 Jan 2003 02:15:52 +0000 Subject: [PATCH] Fixed off by 1 error that was emitting Critical warnings. --- ChangeLog | 5 +++++ plug-ins/common/laplace.c | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 670e9a44f5..3b206418b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-01-30 Seth Burgess + + * plug-ins/common/laplace.c: fixed off-by-1 error that caused + gimp_pixel_rgn_get_row() critical warnings (but managed to work). + 2003-01-30 Pablo Saratxaga * configure.in: Added Vietnamese (vi) to ALL_LINGUAS diff --git a/plug-ins/common/laplace.c b/plug-ins/common/laplace.c index 85a78804cb..86a21bf2be 100644 --- a/plug-ins/common/laplace.c +++ b/plug-ins/common/laplace.c @@ -19,6 +19,11 @@ /* This plugin by thorsten@arch.usyd.edu.au */ /* Based on S&P's Gauss and Laplace filters */ +/* updated 1/30/03: + * fixed an off-by-1 error that was causing an attempt to read a + * get_pixel_by_row at the -1'th row + */ + /* updated 11/04/97: Use 8-pixel neighbourhood to create outline, use min-max operation for local gradient, @@ -147,13 +152,13 @@ laplace_prepare_row (GimpPixelRgn *pixel_rgn, { gint b; - if (y == 0) - gimp_pixel_rgn_get_row (pixel_rgn, data, x, (y + 1), w); + if (y < 0) + gimp_pixel_rgn_get_row (pixel_rgn, data, x, (y + 1), w); else if (y == pixel_rgn->h) - gimp_pixel_rgn_get_row (pixel_rgn, data, x, (y - 1), w); + gimp_pixel_rgn_get_row (pixel_rgn, data, x, (y - 1), w); else - gimp_pixel_rgn_get_row (pixel_rgn, data, x, y, w); - + gimp_pixel_rgn_get_row (pixel_rgn, data, x, y, w); + /* Fill in edge pixels */ for (b = 0; b < pixel_rgn->bpp; b++) {