From 390d48d4369a48de89dbe6f07bff60b06423dd6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Wed, 21 Mar 2012 00:08:40 +0000 Subject: [PATCH] app: add a GIMP_GEGL_RECT utility macro It is evil, but it is possible to take the address of an inline defined struct as an argument in C. =) --- app/core/gimpdrawable-offset.c | 13 ++++--------- app/gegl/gimp-gegl-utils.h | 1 + 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/core/gimpdrawable-offset.c b/app/core/gimpdrawable-offset.c index ca8808cbd9..51d4f1d145 100644 --- a/app/core/gimpdrawable-offset.c +++ b/app/core/gimpdrawable-offset.c @@ -140,15 +140,10 @@ gimp_drawable_offset (GimpDrawable *drawable, /* Copy the center region */ if (width && height) { - src_rect.x = src_x; - src_rect.y = src_y; - src_rect.width = width; - src_rect.height = height; - - dest_rect.x = dest_x; - dest_rect.y = dest_y; - - gegl_buffer_copy (src_buffer, &src_rect, dest_buffer, &dest_rect); + gegl_buffer_copy (src_buffer, + GIMP_GEGL_RECT (src_x, src_y, width, height), + dest_buffer, + GIMP_GEGL_RECT (dest_x,dest_y, width, height)); } if (wrap_around) diff --git a/app/gegl/gimp-gegl-utils.h b/app/gegl/gimp-gegl-utils.h index da5527a5d0..70034fa2fb 100644 --- a/app/gegl/gimp-gegl-utils.h +++ b/app/gegl/gimp-gegl-utils.h @@ -44,5 +44,6 @@ void gimp_gegl_buffer_refetch_tiles (GeglBuffer *buffer) GeglColor * gimp_gegl_color_new (const GimpRGB *rgb); +#define GIMP_GEGL_RECT(x,y,w,h) (&((GeglRectangle){(x), (y), (w), (h)})) #endif /* __GIMP_GEGL_UTILS_H__ */