[gegl] types: add a C++-friendly version of GEGL_RECTANGLE()
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] types: add a C++-friendly version of GEGL_RECTANGLE()
- Date: Wed, 4 Apr 2018 12:36:47 +0000 (UTC)
commit 247138e0658205abb21c3bfe0bc5c4acbf7c8633
Author: Ell <ell_se yahoo com>
Date: Wed Apr 4 08:29:51 2018 -0400
types: add a C++-friendly version of GEGL_RECTANGLE()
gegl/gegl-types.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/gegl/gegl-types.h b/gegl/gegl-types.h
index 81a0d8a..c1d1b11 100644
--- a/gegl/gegl-types.h
+++ b/gegl/gegl-types.h
@@ -79,8 +79,28 @@ struct _GeglRectangle
GType gegl_rectangle_get_type (void) G_GNUC_CONST;
#define GEGL_TYPE_RECTANGLE (gegl_rectangle_get_type())
+#ifndef __cplusplus
+
#define GEGL_RECTANGLE(x,y,w,h) (&((GeglRectangle){(x), (y), (w), (h)}))
+#else
+
+static inline GeglRectangle
+_gegl_rectangle_helper (gint x,
+ gint y,
+ gint width,
+ gint height)
+{
+ GeglRectangle result = {x, y, width, height};
+
+ return result;
+}
+
+#define GEGL_RECTANGLE(x,y,w,h) \
+ ((GeglRectangle *) &(const GeglRectangle &) ::_gegl_rectangle_helper (x, y, w, h))
+
+#endif /* __cplusplus */
+
typedef struct _GeglTileBackend GeglTileBackend;
typedef struct _GeglOperationContext GeglOperationContext;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]