[gimp] app: get rid of #ifdef USE_CAIRO_REGION almost everywhere
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: get rid of #ifdef USE_CAIRO_REGION almost everywhere
- Date: Fri, 22 Oct 2010 17:58:28 +0000 (UTC)
commit 60d24b4c045e2fe51adabdac8f3ba67e67a5a746
Author: Michael Natterer <mitch gimp org>
Date: Fri Oct 22 19:56:59 2010 +0200
app: get rid of #ifdef USE_CAIRO_REGION almost everywhere
get replaced by GDK region functions and use the cairo region
functions unconditionally all over the place.
app/display/display-types.h | 10 +++++++++-
app/display/gimpcanvasarc.c | 4 ----
app/display/gimpcanvasboundary.c | 4 ----
app/display/gimpcanvascorner.c | 4 ----
app/display/gimpcanvascursor.c | 4 ----
app/display/gimpcanvasgrid.c | 4 ----
app/display/gimpcanvasgroup.c | 13 -------------
app/display/gimpcanvasguide.c | 4 ----
app/display/gimpcanvashandle.c | 4 ----
app/display/gimpcanvasitem.c | 17 -----------------
app/display/gimpcanvasline.c | 4 ----
app/display/gimpcanvaspassepartout.c | 8 --------
app/display/gimpcanvaspath.c | 4 ----
app/display/gimpcanvaspen.c | 8 --------
app/display/gimpcanvaspolygon.c | 4 ----
app/display/gimpcanvasrectangle.c | 26 +-------------------------
app/display/gimpcanvassamplepoint.c | 4 ----
app/display/gimpcanvastextcursor.c | 4 ----
app/display/gimpdisplayshell.c | 16 ----------------
19 files changed, 10 insertions(+), 136 deletions(-)
---
diff --git a/app/display/display-types.h b/app/display/display-types.h
index 7e36e3b..62c2743 100644
--- a/app/display/display-types.h
+++ b/app/display/display-types.h
@@ -29,7 +29,15 @@
#endif
#ifndef USE_CAIRO_REGION
-typedef GdkRegion cairo_region_t;
+#define cairo_region_t GdkRegion
+#define cairo_rectangle_int_t GdkRectangle
+#define cairo_region_destroy gdk_region_destroy
+#define cairo_region_union gdk_region_union
+#define cairo_region_create_rectangle gdk_region_rectangle
+#define cairo_region_union_rectangle gdk_region_union_with_rect
+#define cairo_region_get_extents gdk_region_get_clipbox
+#define cairo_region_subtract gdk_region_subtract
+#define cairo_region_xor gdk_region_xor
#endif
diff --git a/app/display/gimpcanvasarc.c b/app/display/gimpcanvasarc.c
index 333563c..a638a6b 100644
--- a/app/display/gimpcanvasarc.c
+++ b/app/display/gimpcanvasarc.c
@@ -305,11 +305,7 @@ gimp_canvas_arc_get_extents (GimpCanvasItem *item,
rectangle.width = ceil (center_x + radius_x + 1.5) - rectangle.x;
rectangle.height = ceil (center_y + radius_y + 1.5) - rectangle.y;
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
GimpCanvasItem *
diff --git a/app/display/gimpcanvasboundary.c b/app/display/gimpcanvasboundary.c
index e37887c..e76a989 100644
--- a/app/display/gimpcanvasboundary.c
+++ b/app/display/gimpcanvasboundary.c
@@ -340,11 +340,7 @@ gimp_canvas_boundary_get_extents (GimpCanvasItem *item,
rectangle.width = x2 - x1 + 4;
rectangle.height = y2 - y1 + 4;
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
GimpCanvasItem *
diff --git a/app/display/gimpcanvascorner.c b/app/display/gimpcanvascorner.c
index 17eb2e7..c1df3f7 100644
--- a/app/display/gimpcanvascorner.c
+++ b/app/display/gimpcanvascorner.c
@@ -423,11 +423,7 @@ gimp_canvas_corner_get_extents (GimpCanvasItem *item,
rectangle.width = ceil (w + 3.0);
rectangle.height = ceil (h + 3.0);
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
GimpCanvasItem *
diff --git a/app/display/gimpcanvascursor.c b/app/display/gimpcanvascursor.c
index 9b95d58..ea83ea0 100644
--- a/app/display/gimpcanvascursor.c
+++ b/app/display/gimpcanvascursor.c
@@ -199,11 +199,7 @@ gimp_canvas_cursor_get_extents (GimpCanvasItem *item,
rectangle.width = ceil (x + GIMP_CURSOR_SIZE + 1.5) - rectangle.x;
rectangle.height = ceil (y + GIMP_CURSOR_SIZE + 1.5) - rectangle.y;
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
GimpCanvasItem *
diff --git a/app/display/gimpcanvasgrid.c b/app/display/gimpcanvasgrid.c
index 304be04..3efa4c1 100644
--- a/app/display/gimpcanvasgrid.c
+++ b/app/display/gimpcanvasgrid.c
@@ -364,11 +364,7 @@ gimp_canvas_grid_get_extents (GimpCanvasItem *item,
rectangle.width = ceil (x2) - rectangle.x;
rectangle.height = ceil (y2) - rectangle.y;
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
static void
diff --git a/app/display/gimpcanvasgroup.c b/app/display/gimpcanvasgroup.c
index 0387606..05c29cc 100644
--- a/app/display/gimpcanvasgroup.c
+++ b/app/display/gimpcanvasgroup.c
@@ -217,13 +217,8 @@ gimp_canvas_group_get_extents (GimpCanvasItem *item,
}
else if (sub_region)
{
-#ifdef USE_CAIRO_REGION
cairo_region_union (region, sub_region);
cairo_region_destroy (sub_region);
-#else
- gdk_region_union (region, sub_region);
- gdk_region_destroy (sub_region);
-#endif
}
}
@@ -279,11 +274,7 @@ gimp_canvas_group_add_item (GimpCanvasGroup *group,
if (region)
{
_gimp_canvas_item_update (GIMP_CANVAS_ITEM (group), region);
-#ifdef USE_CAIRO_REGION
cairo_region_destroy (region);
-#else
- gdk_region_destroy (region);
-#endif
}
}
@@ -320,11 +311,7 @@ gimp_canvas_group_remove_item (GimpCanvasGroup *group,
if (region)
{
_gimp_canvas_item_update (GIMP_CANVAS_ITEM (group), region);
-#ifdef USE_CAIRO_REGION
cairo_region_destroy (region);
-#else
- gdk_region_destroy (region);
-#endif
}
}
diff --git a/app/display/gimpcanvasguide.c b/app/display/gimpcanvasguide.c
index 6476b80..a5e4610 100644
--- a/app/display/gimpcanvasguide.c
+++ b/app/display/gimpcanvasguide.c
@@ -241,11 +241,7 @@ gimp_canvas_guide_get_extents (GimpCanvasItem *item,
rectangle.width = ABS (x2 - x1) + 3.0;
rectangle.height = ABS (y2 - y1) + 3.0;
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
static void
diff --git a/app/display/gimpcanvashandle.c b/app/display/gimpcanvashandle.c
index a852b7a..da11dd4 100644
--- a/app/display/gimpcanvashandle.c
+++ b/app/display/gimpcanvashandle.c
@@ -500,11 +500,7 @@ gimp_canvas_handle_get_extents (GimpCanvasItem *item,
break;
}
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
GimpCanvasItem *
diff --git a/app/display/gimpcanvasitem.c b/app/display/gimpcanvasitem.c
index c841a04..3ec8652 100644
--- a/app/display/gimpcanvasitem.c
+++ b/app/display/gimpcanvasitem.c
@@ -267,11 +267,7 @@ gimp_canvas_item_dispatch_properties_changed (GObject *object,
{
g_signal_emit (object, item_signals[UPDATE], 0,
region);
-#ifdef USE_CAIRO_REGION
cairo_region_destroy (region);
-#else
- gdk_region_destroy (region);
-#endif
}
}
}
@@ -484,13 +480,8 @@ gimp_canvas_item_end_change (GimpCanvasItem *item)
}
else if (private->change_region)
{
-#ifdef USE_CAIRO_REGION
cairo_region_union (region, private->change_region);
cairo_region_destroy (private->change_region);
-#else
- gdk_region_union (region, private->change_region);
- gdk_region_destroy (private->change_region);
-#endif
}
private->change_region = NULL;
@@ -499,20 +490,12 @@ gimp_canvas_item_end_change (GimpCanvasItem *item)
{
g_signal_emit (item, item_signals[UPDATE], 0,
region);
-#ifdef USE_CAIRO_REGION
cairo_region_destroy (region);
-#else
- gdk_region_destroy (region);
-#endif
}
}
else if (private->change_region)
{
-#ifdef USE_CAIRO_REGION
cairo_region_destroy (private->change_region);
-#else
- gdk_region_destroy (private->change_region);
-#endif
private->change_region = NULL;
}
}
diff --git a/app/display/gimpcanvasline.c b/app/display/gimpcanvasline.c
index 9ae7782..bf01e73 100644
--- a/app/display/gimpcanvasline.c
+++ b/app/display/gimpcanvasline.c
@@ -247,11 +247,7 @@ gimp_canvas_line_get_extents (GimpCanvasItem *item,
rectangle.height = ceil (ABS (y2 - y1) + 5.0);
}
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
GimpCanvasItem *
diff --git a/app/display/gimpcanvaspassepartout.c b/app/display/gimpcanvaspassepartout.c
index a022045..961db73 100644
--- a/app/display/gimpcanvaspassepartout.c
+++ b/app/display/gimpcanvaspassepartout.c
@@ -89,19 +89,11 @@ gimp_canvas_passe_partout_get_extents (GimpCanvasItem *item,
gimp_display_shell_draw_get_scaled_image_size (shell,
&rect.width, &rect.height);
-#ifdef USE_CAIRO_REGION
outer = cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rect);
-#else
- outer = gdk_region_rectangle (&rect);
-#endif
inner = GIMP_CANVAS_ITEM_CLASS (parent_class)->get_extents (item, shell);
-#ifdef USE_CAIRO_REGION
cairo_region_subtract (outer, inner);
-#else
- gdk_region_subtract (outer, inner);
-#endif
return outer;
}
diff --git a/app/display/gimpcanvaspath.c b/app/display/gimpcanvaspath.c
index bc3abdb..3a35759 100644
--- a/app/display/gimpcanvaspath.c
+++ b/app/display/gimpcanvaspath.c
@@ -258,11 +258,7 @@ gimp_canvas_path_get_extents (GimpCanvasItem *item,
rectangle.height = ceil (y2 + 1.5) - rectangle.y;
}
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
return NULL;
diff --git a/app/display/gimpcanvaspen.c b/app/display/gimpcanvaspen.c
index 343cb15..a9f508a 100644
--- a/app/display/gimpcanvaspen.c
+++ b/app/display/gimpcanvaspen.c
@@ -172,22 +172,14 @@ gimp_canvas_pen_get_extents (GimpCanvasItem *item,
{
GdkRectangle rectangle;
-#ifdef USE_CAIRO_REGION
cairo_region_get_extents (region, (cairo_rectangle_int_t *) &rectangle);
-#else
- gdk_region_get_clipbox (region, &rectangle);
-#endif
rectangle.x -= ceil (private->width / 2.0);
rectangle.y -= ceil (private->width / 2.0);
rectangle.width += private->width + 1;
rectangle.height += private->width + 1;
-#ifdef USE_CAIRO_REGION
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rectangle);
-#else
- gdk_region_union_with_rect (region, &rectangle);
-#endif
}
return region;
diff --git a/app/display/gimpcanvaspolygon.c b/app/display/gimpcanvaspolygon.c
index daac2df..5493b43 100644
--- a/app/display/gimpcanvaspolygon.c
+++ b/app/display/gimpcanvaspolygon.c
@@ -285,11 +285,7 @@ gimp_canvas_polygon_get_extents (GimpCanvasItem *item,
rectangle.width = x2 - x1;
rectangle.height = y2 - y1;
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
GimpCanvasItem *
diff --git a/app/display/gimpcanvasrectangle.c b/app/display/gimpcanvasrectangle.c
index d7e3415..55f7607 100644
--- a/app/display/gimpcanvasrectangle.c
+++ b/app/display/gimpcanvasrectangle.c
@@ -276,11 +276,7 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
rectangle.width = ceil (w + 2.0);
rectangle.height = ceil (h + 2.0);
-#ifdef USE_CAIRO_REGION
- return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
+ return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
}
else if (w > 64 && h > 64)
{
@@ -292,20 +288,12 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
rectangle.width = 3.0;
rectangle.height = ceil (h + 3.0);
-#ifdef USE_CAIRO_REGION
region = cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- region = gdk_region_rectangle (&rectangle);
-#endif
/* right */
rectangle.x = floor (x + w - 1.5);
-#ifdef USE_CAIRO_REGION
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rectangle);
-#else
- gdk_region_union_with_rect (region, &rectangle);
-#endif
/* top */
rectangle.x = floor (x - 1.5);
@@ -313,20 +301,12 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
rectangle.width = ceil (w + 3.0);
rectangle.height = 3.0;
-#ifdef USE_CAIRO_REGION
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rectangle);
-#else
- gdk_region_union_with_rect (region, &rectangle);
-#endif
/* bottom */
rectangle.y = floor (y + h - 1.5);
-#ifdef USE_CAIRO_REGION
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rectangle);
-#else
- gdk_region_union_with_rect (region, &rectangle);
-#endif
return region;
}
@@ -337,11 +317,7 @@ gimp_canvas_rectangle_get_extents (GimpCanvasItem *item,
rectangle.width = ceil (w + 3.0);
rectangle.height = ceil (h + 3.0);
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
}
diff --git a/app/display/gimpcanvassamplepoint.c b/app/display/gimpcanvassamplepoint.c
index 93f70bb..30d3f30 100644
--- a/app/display/gimpcanvassamplepoint.c
+++ b/app/display/gimpcanvassamplepoint.c
@@ -281,11 +281,7 @@ gimp_canvas_sample_point_get_extents (GimpCanvasItem *item,
rectangle.width += 5;
rectangle.height += 5;
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
static void
diff --git a/app/display/gimpcanvastextcursor.c b/app/display/gimpcanvastextcursor.c
index c33b470..440dfd5 100644
--- a/app/display/gimpcanvastextcursor.c
+++ b/app/display/gimpcanvastextcursor.c
@@ -294,11 +294,7 @@ gimp_canvas_text_cursor_get_extents (GimpCanvasItem *item,
rectangle.height = ceil (h + 3.0);
}
-#ifdef USE_CAIRO_REGION
return cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rectangle);
-#else
- return gdk_region_rectangle (&rectangle);
-#endif
}
GimpCanvasItem *
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index 96353b3..8820cee 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -1768,33 +1768,17 @@ gimp_display_shell_set_highlight (GimpDisplayShell *shell,
if (memcmp (shell->highlight, highlight, sizeof (GdkRectangle)) == 0)
return;
-#ifdef USE_CAIRO_REGION
old = cairo_region_create_rectangle ((cairo_rectangle_int_t *) shell->highlight);
-#else
- old = gdk_region_rectangle (shell->highlight);
-#endif
*shell->highlight = *highlight;
-#ifdef USE_CAIRO_REGION
new = cairo_region_create_rectangle ((cairo_rectangle_int_t *) shell->highlight);
-
cairo_region_xor (old, new);
-#else
- new = gdk_region_rectangle (shell->highlight);
-
- gdk_region_xor (old, new);
-#endif
gimp_display_shell_expose_region (shell, old);
-#ifdef USE_CAIRO_REGION
cairo_region_destroy (old);
cairo_region_destroy (new);
-#else
- gdk_region_destroy (old);
- gdk_region_destroy (new);
-#endif
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]