[gimp] app: add a GIMP_GEGL_RECT utility macro
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add a GIMP_GEGL_RECT utility macro
- Date: Wed, 2 May 2012 16:11:20 +0000 (UTC)
commit 390d48d4369a48de89dbe6f07bff60b06423dd6f
Author: Ãyvind KolÃs <pippin gimp org>
Date: Wed Mar 21 00:08:40 2012 +0000
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 ca8808c..51d4f1d 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 da5527a..70034fa 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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]