From bbbc0347938bd3ddab7fff991e2bacfaea7eba3c Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 2 May 2002 17:23:54 +0000 Subject: [PATCH] fixed typo. 2002-05-02 Sven Neumann * app/core/gimpimagefile.c (gimp_imagefile_save_thumbnail): fixed typo. * plug-ins/rcm/rcm_misc.c (rcm_reduce_image): merged fix for bug #80561 from stable branch. --- ChangeLog | 8 ++++++++ app/core/gimpimagefile.c | 2 +- plug-ins/rcm/rcm_misc.c | 28 ++++++++++++++++++++-------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76a6ea7851..de87795e09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-05-02 Sven Neumann + + * app/core/gimpimagefile.c (gimp_imagefile_save_thumbnail): fixed + typo. + + * plug-ins/rcm/rcm_misc.c (rcm_reduce_image): merged fix for bug + #80561 from stable branch. + 2002-05-02 Michael Natterer * plug-ins/script-fu/script-fu-console.c: fixed communication diff --git a/app/core/gimpimagefile.c b/app/core/gimpimagefile.c index ceb5f90bb4..bca25c4032 100644 --- a/app/core/gimpimagefile.c +++ b/app/core/gimpimagefile.c @@ -489,7 +489,7 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile, return TRUE; uri = gimp_object_get_name (GIMP_OBJECT (imagefile)); - image_uri = gimp_object_get_name (GIMP_OBJECT (imagefile)); + image_uri = gimp_object_get_name (GIMP_OBJECT (gimage)); g_return_val_if_fail (uri && image_uri && ! strcmp (uri, image_uri), FALSE); diff --git a/plug-ins/rcm/rcm_misc.c b/plug-ins/rcm/rcm_misc.c index 3e54f1f5f3..f5a3fe1ba3 100644 --- a/plug-ins/rcm/rcm_misc.c +++ b/plug-ins/rcm/rcm_misc.c @@ -194,6 +194,7 @@ rcm_reduce_image (GimpDrawable *drawable, gint LongerSize, gint Slctn) { + guint32 gimage; GimpPixelRgn srcPR, srcMask; ReducedImage *temp; guchar *tempRGB, *src_row, *tempmask, *src_mask_row; @@ -204,7 +205,7 @@ rcm_reduce_image (GimpDrawable *drawable, gdouble *tempHSV, H, S, V; bytes = drawable->bpp; - temp = g_new (ReducedImage, 1); + temp = g_new0 (ReducedImage, 1); /* get bounds of image or selection */ @@ -225,21 +226,34 @@ rcm_reduce_image (GimpDrawable *drawable, break; case SELECTION_IN_CONTEXT: - x1 = MAX(0, x1 - (x2-x1) / 2.0); - x2 = MIN(drawable->width, x2 + (x2-x1) / 2.0); - y1 = MAX(0, y1 - (y2-y1) / 2.0); - y2 = MIN(drawable->height, y2 + (y2-y1) / 2.0); + x1 = MAX (0, x1 - (x2-x1) / 2.0); + x2 = MIN (drawable->width, x2 + (x2-x1) / 2.0); + y1 = MAX (0, y1 - (y2-y1) / 2.0); + y2 = MIN (drawable->height, y2 + (y2-y1) / 2.0); break; default: break; /* take selection dimensions */ } + /* clamp to image size since this is the size of the mask */ + + gimp_drawable_offsets (drawable->drawable_id, &offx, &offy); + gimage = gimp_drawable_image (drawable->drawable_id); + + x1 = CLAMP (x1, - offx, gimp_image_width (gimage) - offx); + x2 = CLAMP (x2, - offx, gimp_image_width (gimage) - offx); + y1 = CLAMP (y1, - offy, gimp_image_height (gimage) - offy); + y2 = CLAMP (y2, - offy, gimp_image_height (gimage) - offy); + /* calculate size of preview */ width = x2 - x1; height = y2 - y1; + if (width < 1 || height < 1) + return temp; + if (width > height) { RW = LongerSize; @@ -257,9 +271,7 @@ rcm_reduce_image (GimpDrawable *drawable, tempHSV = g_new (gdouble, RW * RH * bytes); tempmask = g_new (guchar, RW * RH); - gimp_pixel_rgn_init(&srcPR, drawable, x1, y1, width, height, FALSE, FALSE); - - gimp_drawable_offsets (drawable->drawable_id, &offx, &offy); + gimp_pixel_rgn_init (&srcPR, drawable, x1, y1, width, height, FALSE, FALSE); gimp_pixel_rgn_init (&srcMask, mask, x1 + offx, y1 + offy, width, height, FALSE, FALSE);