[gimp] app: add the MIN4() and MAX4() macros to gimp-utils.h
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add the MIN4() and MAX4() macros to gimp-utils.h
- Date: Sat, 4 Jun 2011 15:17:03 +0000 (UTC)
commit ea27c7bc838a093f5b158bf4027c3de1d55ecff2
Author: Michael Natterer <mitch gimp org>
Date: Sat Jun 4 17:16:21 2011 +0200
app: add the MIN4() and MAX4() macros to gimp-utils.h
instead of having them in 5 .c files.
app/core/gimp-transform-resize.c | 5 ++---
app/core/gimp-utils.h | 4 ++++
app/display/gimpcanvastransformpreview.c | 4 +---
app/paint/gimpperspectiveclone.c | 5 +----
app/tools/gimptransformtool.c | 3 +--
app/widgets/gimpoverlaychild.c | 5 ++---
6 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/app/core/gimp-transform-resize.c b/app/core/gimp-transform-resize.c
index b7944f3..170dbe8 100644
--- a/app/core/gimp-transform-resize.c
+++ b/app/core/gimp-transform-resize.c
@@ -24,6 +24,7 @@
#include "core-types.h"
#include "gimp-transform-resize.h"
+#include "gimp-utils.h"
#if defined (HAVE_FINITE)
@@ -36,9 +37,7 @@
#error "no FINITE() implementation available?!"
#endif
-#define EPSILON 0.00000001
-#define MIN4(a,b,c,d) MIN(MIN((a),(b)),MIN((c),(d)))
-#define MAX4(a,b,c,d) MAX(MAX((a),(b)),MAX((c),(d)))
+#define EPSILON 0.00000001
typedef struct
diff --git a/app/core/gimp-utils.h b/app/core/gimp-utils.h
index 91fad8d..5eff64b 100644
--- a/app/core/gimp-utils.h
+++ b/app/core/gimp-utils.h
@@ -28,6 +28,10 @@
g_timer_destroy (_timer); }
+#define MIN4(a,b,c,d) MIN (MIN ((a), (b)), MIN ((c), (d)))
+#define MAX4(a,b,c,d) MAX (MAX ((a), (b)), MAX ((c), (d)))
+
+
gint64 gimp_g_type_instance_get_memsize (GTypeInstance *instance);
gint64 gimp_g_object_get_memsize (GObject *object);
gint64 gimp_g_hash_table_get_memsize (GHashTable *hash,
diff --git a/app/display/gimpcanvastransformpreview.c b/app/display/gimpcanvastransformpreview.c
index 21c3e6d..8ceada3 100644
--- a/app/display/gimpcanvastransformpreview.c
+++ b/app/display/gimpcanvastransformpreview.c
@@ -35,6 +35,7 @@
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimp-transform-utils.h"
+#include "core/gimp-utils.h"
#include "gimpcanvas.h"
#include "gimpcanvastransformpreview.h"
@@ -46,9 +47,6 @@
#define INT_MULT3(a,b,c,t) ((t) = (a) * (b) * (c) + 0x7F5B, \
((((t) >> 7) + (t)) >> 16))
-#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d))
-#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
-
#define MAX_SUB_COLS 6 /* number of columns and */
#define MAX_SUB_ROWS 6 /* rows to use in perspective preview subdivision */
diff --git a/app/paint/gimpperspectiveclone.c b/app/paint/gimpperspectiveclone.c
index 3ac0cc3..4906d36 100644
--- a/app/paint/gimpperspectiveclone.c
+++ b/app/paint/gimpperspectiveclone.c
@@ -39,6 +39,7 @@
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimp-transform-region.h"
+#include "core/gimp-utils.h"
#include "gimpperspectiveclone.h"
#include "gimpperspectivecloneoptions.h"
@@ -46,10 +47,6 @@
#include "gimp-intl.h"
-#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d))
-#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
-
-
static void gimp_perspective_clone_finalize (GObject *object);
static gboolean gimp_perspective_clone_start (GimpPaintCore *paint_core,
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 7e10812..e4df344 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -45,6 +45,7 @@
#include "core/gimpprogress.h"
#include "core/gimptoolinfo.h"
#include "core/gimp-transform-utils.h"
+#include "core/gimp-utils.h"
#include "vectors/gimpvectors.h"
#include "vectors/gimpstroke.h"
@@ -68,8 +69,6 @@
#define RESPONSE_RESET 1
#define MIN_HANDLE_SIZE 6
-#define MIN4(a,b,c,d) MIN(MIN((a),(b)),MIN((c),(d)))
-#define MAX4(a,b,c,d) MAX(MAX((a),(b)),MAX((c),(d)))
static void gimp_transform_tool_finalize (GObject *object);
diff --git a/app/widgets/gimpoverlaychild.c b/app/widgets/gimpoverlaychild.c
index 5355996..a9ff575 100644
--- a/app/widgets/gimpoverlaychild.c
+++ b/app/widgets/gimpoverlaychild.c
@@ -27,6 +27,8 @@
#include "widgets-types.h"
+#include "core/gimp-utils.h"
+
#include "gimpoverlaybox.h"
#include "gimpoverlaychild.h"
@@ -491,9 +493,6 @@ gimp_overlay_child_transform_bounds (GimpOverlayChild *child,
cairo_matrix_transform_point (&child->matrix, &x3, &y3);
cairo_matrix_transform_point (&child->matrix, &x4, &y4);
-#define MIN4(a,b,c,d) MIN(MIN((a),(b)),MIN((c),(d)))
-#define MAX4(a,b,c,d) MAX(MAX((a),(b)),MAX((c),(d)))
-
bounds_box->x = (gint) floor (MIN4 (x1, x2, x3, x4));
bounds_box->y = (gint) floor (MIN4 (y1, y2, y3, y4));
bounds_box->width = (gint) ceil (MAX4 (x1, x2, x3, x4)) - bounds_box->x;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]