From ce4234b2a6bff683a77bd3485e710d9ec80517c3 Mon Sep 17 00:00:00 2001 From: jaycox Date: Fri, 28 Apr 2000 23:59:40 +0000 Subject: [PATCH] Correctly initialize the max arrays in thin_region. Fixes bug #8351 return * app/paint_funcs.c: Correctly initialize the max arrays in thin_region. Fixes bug #8351 * app/scale.c: return from the channel_scale function if we tried to zoom in/out too far. This prevents some unnecessary display redraws. --- ChangeLog | 8 ++++++++ app/display/gimpdisplay-scale.c | 4 ++++ app/display/gimpdisplayshell-scale.c | 4 ++++ app/paint-funcs/paint-funcs.c | 8 +++++--- app/paint_funcs.c | 8 +++++--- app/scale.c | 4 ++++ 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index cfc9d2700b..7e81820171 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-04-28 Jay Cox + + * app/paint_funcs.c: Correctly initialize the max arrays in + thin_region. Fixes bug #8351 + * app/scale.c: return from the channel_scale function if we + tried to zoom in/out too far. This prevents some + unnecessary display redraws. + 2000-04-28 Sven Neumann * plug-ins/print/print-util.c: do not use error_t, some systems diff --git a/app/display/gimpdisplay-scale.c b/app/display/gimpdisplay-scale.c index b05b56d6a0..3af11761f4 100644 --- a/app/display/gimpdisplay-scale.c +++ b/app/display/gimpdisplay-scale.c @@ -113,6 +113,8 @@ change_scale (GDisplay *gdisp, else if (scaledest < 0x10) scaledest++; + else + return; break; case ZOOMOUT : @@ -121,6 +123,8 @@ change_scale (GDisplay *gdisp, else if (scalesrc < 0x10) scalesrc++; + else + return; break; default : diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c index b05b56d6a0..3af11761f4 100644 --- a/app/display/gimpdisplayshell-scale.c +++ b/app/display/gimpdisplayshell-scale.c @@ -113,6 +113,8 @@ change_scale (GDisplay *gdisp, else if (scaledest < 0x10) scaledest++; + else + return; break; case ZOOMOUT : @@ -121,6 +123,8 @@ change_scale (GDisplay *gdisp, else if (scalesrc < 0x10) scalesrc++; + else + return; break; default : diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c index 175f39effd..87dccb534f 100644 --- a/app/paint-funcs/paint-funcs.c +++ b/app/paint-funcs/paint-funcs.c @@ -4691,6 +4691,10 @@ thin_region(PixelRegion *src, gint16 xradius, gint16 yradius, int edge_lock) buf[i] = (guchar *)g_malloc (src->w * sizeof(guchar)); } buffer = g_malloc ((src->w+2*xradius + 1)*(yradius+1)); + if (edge_lock) + memset(buffer, 255, (src->w+2*xradius + 1)*(yradius+1)); + else + memset(buffer, 0, (src->w+2*xradius + 1)*(yradius+1)); for (i = 0; i < src->w+2*xradius; i++) { if (i < xradius) @@ -4705,8 +4709,6 @@ thin_region(PixelRegion *src, gint16 xradius, gint16 yradius, int edge_lock) max[i] = &buffer[(yradius+1)*(src->w + xradius - 1)]; else max[i] = &buffer[(yradius+1)*(src->w + xradius)]; - for (j = 0 ; j < xradius+1; j++) - max[i][j] = 255; } if (!edge_lock) for (j = 0 ; j < xradius+1; j++) @@ -4723,7 +4725,7 @@ thin_region(PixelRegion *src, gint16 xradius, gint16 yradius, int edge_lock) if (edge_lock) memcpy (buf[0], buf[1], src->w); else - memset(buf[0], 0, src->w); + memset (buf[0], 0, src->w); for (x = 0; x < src->w; x++) /* set up max for top of image */ { max[x][0] = buf[0][x]; diff --git a/app/paint_funcs.c b/app/paint_funcs.c index 175f39effd..87dccb534f 100644 --- a/app/paint_funcs.c +++ b/app/paint_funcs.c @@ -4691,6 +4691,10 @@ thin_region(PixelRegion *src, gint16 xradius, gint16 yradius, int edge_lock) buf[i] = (guchar *)g_malloc (src->w * sizeof(guchar)); } buffer = g_malloc ((src->w+2*xradius + 1)*(yradius+1)); + if (edge_lock) + memset(buffer, 255, (src->w+2*xradius + 1)*(yradius+1)); + else + memset(buffer, 0, (src->w+2*xradius + 1)*(yradius+1)); for (i = 0; i < src->w+2*xradius; i++) { if (i < xradius) @@ -4705,8 +4709,6 @@ thin_region(PixelRegion *src, gint16 xradius, gint16 yradius, int edge_lock) max[i] = &buffer[(yradius+1)*(src->w + xradius - 1)]; else max[i] = &buffer[(yradius+1)*(src->w + xradius)]; - for (j = 0 ; j < xradius+1; j++) - max[i][j] = 255; } if (!edge_lock) for (j = 0 ; j < xradius+1; j++) @@ -4723,7 +4725,7 @@ thin_region(PixelRegion *src, gint16 xradius, gint16 yradius, int edge_lock) if (edge_lock) memcpy (buf[0], buf[1], src->w); else - memset(buf[0], 0, src->w); + memset (buf[0], 0, src->w); for (x = 0; x < src->w; x++) /* set up max for top of image */ { max[x][0] = buf[0][x]; diff --git a/app/scale.c b/app/scale.c index b05b56d6a0..3af11761f4 100644 --- a/app/scale.c +++ b/app/scale.c @@ -113,6 +113,8 @@ change_scale (GDisplay *gdisp, else if (scaledest < 0x10) scaledest++; + else + return; break; case ZOOMOUT : @@ -121,6 +123,8 @@ change_scale (GDisplay *gdisp, else if (scalesrc < 0x10) scalesrc++; + else + return; break; default :