[gimp] app: don't ignore the return value of gimp_rectangle_intersect()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: don't ignore the return value of gimp_rectangle_intersect()
- Date: Sat, 16 Nov 2013 08:41:07 +0000 (UTC)
commit 2b7f38f47362a5cb3d21b1bc26778f8abbd181fa
Author: Michael Natterer <mitch gimp org>
Date: Sat Nov 16 09:38:29 2013 +0100
app: don't ignore the return value of gimp_rectangle_intersect()
In gimp_drawable_resize(), don't blindly copy the width and height
returned by gimp_rectangle_intersect(), we have to check if the
function actually returned TRUE.
app/core/gimpdrawable.c | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 61c7d93..5b35ad5 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -550,35 +550,37 @@ gimp_drawable_resize (GimpItem *item,
gint new_offset_y;
gint copy_x, copy_y;
gint copy_width, copy_height;
+ gboolean intersect;
/* if the size doesn't change, this is a nop */
if (new_width == gimp_item_get_width (item) &&
new_height == gimp_item_get_height (item) &&
- offset_x == 0 &&
+ offset_x == 0 &&
offset_y == 0)
return;
new_offset_x = gimp_item_get_offset_x (item) - offset_x;
new_offset_y = gimp_item_get_offset_y (item) - offset_y;
- gimp_rectangle_intersect (gimp_item_get_offset_x (item),
- gimp_item_get_offset_y (item),
- gimp_item_get_width (item),
- gimp_item_get_height (item),
- new_offset_x,
- new_offset_y,
- new_width,
- new_height,
- ©_x,
- ©_y,
- ©_width,
- ©_height);
+ intersect = gimp_rectangle_intersect (gimp_item_get_offset_x (item),
+ gimp_item_get_offset_y (item),
+ gimp_item_get_width (item),
+ gimp_item_get_height (item),
+ new_offset_x,
+ new_offset_y,
+ new_width,
+ new_height,
+ ©_x,
+ ©_y,
+ ©_width,
+ ©_height);
new_buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0,
new_width, new_height),
gimp_drawable_get_format (drawable));
- if (copy_width != new_width ||
+ if (! intersect ||
+ copy_width != new_width ||
copy_height != new_height)
{
/* Clear the new tiles if needed */
@@ -597,7 +599,7 @@ gimp_drawable_resize (GimpItem *item,
g_object_unref (col);
}
- if (copy_width && copy_height)
+ if (intersect && copy_width && copy_height)
{
/* Copy the pixels in the intersection */
gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]