[gimp] app: remove "shell" parameter from GimpCanvasItem's public APIs
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: remove "shell" parameter from GimpCanvasItem's public APIs
- Date: Fri, 1 Oct 2010 16:58:02 +0000 (UTC)
commit d3f19baf0d5b1c91271c27917a8500b0aeb64962
Author: Michael Natterer <mitch gimp org>
Date: Fri Oct 1 14:54:53 2010 +0200
app: remove "shell" parameter from GimpCanvasItem's public APIs
because each item has a shell now. Keep the parameter in the virtual
functions though because that saves a lot of code in the subclasses.
app/display/gimpcanvasarc.c | 4 +-
app/display/gimpcanvasboundary.c | 2 +-
app/display/gimpcanvascorner.c | 2 +-
app/display/gimpcanvasgroup.c | 9 +++----
app/display/gimpcanvasguide.c | 2 +-
app/display/gimpcanvashandle.c | 10 ++++----
app/display/gimpcanvasitem.c | 32 +++++++++++++++--------------
app/display/gimpcanvasitem.h | 6 +----
app/display/gimpcanvasline.c | 2 +-
app/display/gimpcanvaspolygon.c | 4 +-
app/display/gimpcanvasrectangle.c | 4 +-
app/display/gimpcanvassamplepoint.c | 4 +-
app/display/gimpcanvastextcursor.c | 2 +-
app/display/gimpdisplayshell-callbacks.c | 2 +-
app/display/gimpdisplayshell-expose.c | 2 +-
15 files changed, 42 insertions(+), 45 deletions(-)
---
diff --git a/app/display/gimpcanvasarc.c b/app/display/gimpcanvasarc.c
index a0f9035..7650e01 100644
--- a/app/display/gimpcanvasarc.c
+++ b/app/display/gimpcanvasarc.c
@@ -279,9 +279,9 @@ gimp_canvas_arc_draw (GimpCanvasItem *item,
cairo_restore (cr);
if (private->filled)
- _gimp_canvas_item_fill (item, shell, cr);
+ _gimp_canvas_item_fill (item, cr);
else
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
}
static GdkRegion *
diff --git a/app/display/gimpcanvasboundary.c b/app/display/gimpcanvasboundary.c
index 7b351c4..b9c2599 100644
--- a/app/display/gimpcanvasboundary.c
+++ b/app/display/gimpcanvasboundary.c
@@ -242,7 +242,7 @@ gimp_canvas_boundary_draw (GimpCanvasItem *item,
gimp_cairo_add_segments (cr, segs, private->n_segs);
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
g_free (segs);
}
diff --git a/app/display/gimpcanvascorner.c b/app/display/gimpcanvascorner.c
index e7b6357..5e49234 100644
--- a/app/display/gimpcanvascorner.c
+++ b/app/display/gimpcanvascorner.c
@@ -405,7 +405,7 @@ gimp_canvas_corner_draw (GimpCanvasItem *item,
cairo_rectangle (cr, x, y, w, h);
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
}
static GdkRegion *
diff --git a/app/display/gimpcanvasgroup.c b/app/display/gimpcanvasgroup.c
index 7a7775e..641d6f4 100644
--- a/app/display/gimpcanvasgroup.c
+++ b/app/display/gimpcanvasgroup.c
@@ -185,14 +185,14 @@ gimp_canvas_group_draw (GimpCanvasItem *item,
{
GimpCanvasItem *sub_item = list->data;
- gimp_canvas_item_draw (sub_item, shell, cr);
+ gimp_canvas_item_draw (sub_item, cr);
}
if (private->group_stroking)
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
if (private->group_filling)
- _gimp_canvas_item_fill (item, shell, cr);
+ _gimp_canvas_item_fill (item, cr);
}
static GdkRegion *
@@ -206,8 +206,7 @@ gimp_canvas_group_get_extents (GimpCanvasItem *item,
for (list = private->items; list; list = g_list_next (list))
{
GimpCanvasItem *sub_item = list->data;
- GdkRegion *sub_region = gimp_canvas_item_get_extents (sub_item,
- shell);
+ GdkRegion *sub_region = gimp_canvas_item_get_extents (sub_item);
if (! region)
{
diff --git a/app/display/gimpcanvasguide.c b/app/display/gimpcanvasguide.c
index ebaa537..2102e64 100644
--- a/app/display/gimpcanvasguide.c
+++ b/app/display/gimpcanvasguide.c
@@ -223,7 +223,7 @@ gimp_canvas_guide_draw (GimpCanvasItem *item,
cairo_move_to (cr, x1, y1);
cairo_line_to (cr, x2, y2);
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
}
static GdkRegion *
diff --git a/app/display/gimpcanvashandle.c b/app/display/gimpcanvashandle.c
index 02634e7..fbe7a37 100644
--- a/app/display/gimpcanvashandle.c
+++ b/app/display/gimpcanvashandle.c
@@ -425,13 +425,13 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
case GIMP_HANDLE_SQUARE:
cairo_rectangle (cr, x, y, private->width - 1.0, private->height - 1.0);
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
break;
case GIMP_HANDLE_FILLED_SQUARE:
cairo_rectangle (cr, x - 0.5, y - 0.5, private->width, private->height);
- _gimp_canvas_item_fill (item, shell, cr);
+ _gimp_canvas_item_fill (item, cr);
break;
case GIMP_HANDLE_CIRCLE:
@@ -439,7 +439,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
private->start_angle,
private->slice_angle);
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
break;
case GIMP_HANDLE_FILLED_CIRCLE:
@@ -449,7 +449,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
private->start_angle,
private->slice_angle);
- _gimp_canvas_item_fill (item, shell, cr);
+ _gimp_canvas_item_fill (item, cr);
break;
case GIMP_HANDLE_CROSS:
@@ -459,7 +459,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
cairo_move_to (cr, x, y - private->height / 2);
cairo_line_to (cr, x, y + private->height / 2);
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
break;
default:
diff --git a/app/display/gimpcanvasitem.c b/app/display/gimpcanvasitem.c
index 4521a42..b58bcb9 100644
--- a/app/display/gimpcanvasitem.c
+++ b/app/display/gimpcanvasitem.c
@@ -252,29 +252,33 @@ gimp_canvas_item_real_fill (GimpCanvasItem *item,
/* public functions */
void
-gimp_canvas_item_draw (GimpCanvasItem *item,
- GimpDisplayShell *shell,
- cairo_t *cr)
+gimp_canvas_item_draw (GimpCanvasItem *item,
+ cairo_t *cr)
{
+ GimpCanvasItemPrivate *private;
+
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
- g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
+ private = GET_PRIVATE (item);
+
cairo_save (cr);
- GIMP_CANVAS_ITEM_GET_CLASS (item)->draw (item, shell, cr);
+ GIMP_CANVAS_ITEM_GET_CLASS (item)->draw (item, private->shell, cr);
cairo_restore (cr);
}
GdkRegion *
-gimp_canvas_item_get_extents (GimpCanvasItem *item,
- GimpDisplayShell *shell)
+gimp_canvas_item_get_extents (GimpCanvasItem *item)
{
+ GimpCanvasItemPrivate *private;
+
g_return_val_if_fail (GIMP_IS_CANVAS_ITEM (item), NULL);
- g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
- return GIMP_CANVAS_ITEM_GET_CLASS (item)->get_extents (item, shell);
+ private = GET_PRIVATE (item);
+
+ return GIMP_CANVAS_ITEM_GET_CLASS (item)->get_extents (item, private->shell);
}
void
@@ -367,9 +371,8 @@ gimp_canvas_item_resume_filling (GimpCanvasItem *item)
/* protected functions */
void
-_gimp_canvas_item_stroke (GimpCanvasItem *item,
- GimpDisplayShell *shell,
- cairo_t *cr)
+_gimp_canvas_item_stroke (GimpCanvasItem *item,
+ cairo_t *cr)
{
GimpCanvasItemPrivate *private = GET_PRIVATE (item);
@@ -378,7 +381,7 @@ _gimp_canvas_item_stroke (GimpCanvasItem *item,
if (private->suspend_stroking == 0)
{
- GIMP_CANVAS_ITEM_GET_CLASS (item)->stroke (item, shell, cr);
+ GIMP_CANVAS_ITEM_GET_CLASS (item)->stroke (item, private->shell, cr);
}
else
{
@@ -388,7 +391,6 @@ _gimp_canvas_item_stroke (GimpCanvasItem *item,
void
_gimp_canvas_item_fill (GimpCanvasItem *item,
- GimpDisplayShell *shell,
cairo_t *cr)
{
GimpCanvasItemPrivate *private = GET_PRIVATE (item);
@@ -398,7 +400,7 @@ _gimp_canvas_item_fill (GimpCanvasItem *item,
if (private->suspend_filling == 0)
{
- GIMP_CANVAS_ITEM_GET_CLASS (item)->fill (item, shell, cr);
+ GIMP_CANVAS_ITEM_GET_CLASS (item)->fill (item, private->shell, cr);
}
else
{
diff --git a/app/display/gimpcanvasitem.h b/app/display/gimpcanvasitem.h
index c086e0b..f878550 100644
--- a/app/display/gimpcanvasitem.h
+++ b/app/display/gimpcanvasitem.h
@@ -62,10 +62,8 @@ struct _GimpCanvasItemClass
GType gimp_canvas_item_get_type (void) G_GNUC_CONST;
void gimp_canvas_item_draw (GimpCanvasItem *item,
- GimpDisplayShell *shell,
cairo_t *cr);
-GdkRegion * gimp_canvas_item_get_extents (GimpCanvasItem *item,
- GimpDisplayShell *shell);
+GdkRegion * gimp_canvas_item_get_extents (GimpCanvasItem *item);
void gimp_canvas_item_set_line_cap (GimpCanvasItem *item,
cairo_line_cap_t line_cap);
@@ -84,10 +82,8 @@ void gimp_canvas_item_resume_filling (GimpCanvasItem *item);
/* protected */
void _gimp_canvas_item_stroke (GimpCanvasItem *item,
- GimpDisplayShell *shell,
cairo_t *cr);
void _gimp_canvas_item_fill (GimpCanvasItem *item,
- GimpDisplayShell *shell,
cairo_t *cr);
diff --git a/app/display/gimpcanvasline.c b/app/display/gimpcanvasline.c
index 8b01b98..a60c953 100644
--- a/app/display/gimpcanvasline.c
+++ b/app/display/gimpcanvasline.c
@@ -219,7 +219,7 @@ gimp_canvas_line_draw (GimpCanvasItem *item,
cairo_move_to (cr, x1, y1);
cairo_line_to (cr, x2, y2);
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
}
static GdkRegion *
diff --git a/app/display/gimpcanvaspolygon.c b/app/display/gimpcanvaspolygon.c
index b0a5fa8..90d5c80 100644
--- a/app/display/gimpcanvaspolygon.c
+++ b/app/display/gimpcanvaspolygon.c
@@ -213,9 +213,9 @@ gimp_canvas_polygon_draw (GimpCanvasItem *item,
}
if (private->filled)
- _gimp_canvas_item_fill (item, shell, cr);
+ _gimp_canvas_item_fill (item, cr);
else
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
g_free (points);
}
diff --git a/app/display/gimpcanvasrectangle.c b/app/display/gimpcanvasrectangle.c
index 131ee40..71202b7 100644
--- a/app/display/gimpcanvasrectangle.c
+++ b/app/display/gimpcanvasrectangle.c
@@ -253,9 +253,9 @@ gimp_canvas_rectangle_draw (GimpCanvasItem *item,
cairo_rectangle (cr, x, y, w, h);
if (private->filled)
- _gimp_canvas_item_fill (item, shell, cr);
+ _gimp_canvas_item_fill (item, cr);
else
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
}
static GdkRegion *
diff --git a/app/display/gimpcanvassamplepoint.c b/app/display/gimpcanvassamplepoint.c
index cd60d85..acff04d 100644
--- a/app/display/gimpcanvassamplepoint.c
+++ b/app/display/gimpcanvassamplepoint.c
@@ -246,7 +246,7 @@ gimp_canvas_sample_point_draw (GimpCanvasItem *item,
cairo_arc_negative (cr, x, y, HALF_SIZE, 0.0, 0.5 * G_PI);
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
layout = gimp_canvas_get_layout (GIMP_CANVAS (shell->canvas),
"%d", private->index);
@@ -254,7 +254,7 @@ gimp_canvas_sample_point_draw (GimpCanvasItem *item,
cairo_move_to (cr, x + 2.5, y + 2.5);
pango_cairo_show_layout (cr, layout);
- _gimp_canvas_item_fill (item, shell, cr);
+ _gimp_canvas_item_fill (item, cr);
}
static GdkRegion *
diff --git a/app/display/gimpcanvastextcursor.c b/app/display/gimpcanvastextcursor.c
index 34d6b59..e21a795 100644
--- a/app/display/gimpcanvastextcursor.c
+++ b/app/display/gimpcanvastextcursor.c
@@ -261,7 +261,7 @@ gimp_canvas_text_cursor_draw (GimpCanvasItem *item,
cairo_line_to (cr, x + 3.0, y + h);
}
- _gimp_canvas_item_stroke (item, shell, cr);
+ _gimp_canvas_item_stroke (item, cr);
}
static GdkRegion *
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index 61f2f29..9508502 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -2342,7 +2342,7 @@ gimp_display_shell_canvas_expose_image (GimpDisplayShell *shell,
/* draw canvas items */
cairo_save (cr);
- gimp_canvas_item_draw (shell->canvas_item, shell, cr);
+ gimp_canvas_item_draw (shell->canvas_item, cr);
cairo_restore (cr);
/* and the cursor (if we have a software cursor) */
diff --git a/app/display/gimpdisplayshell-expose.c b/app/display/gimpdisplayshell-expose.c
index b3e8abb..eb959b0 100644
--- a/app/display/gimpdisplayshell-expose.c
+++ b/app/display/gimpdisplayshell-expose.c
@@ -73,7 +73,7 @@ gimp_display_shell_expose_item (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
- region = gimp_canvas_item_get_extents (item, shell);
+ region = gimp_canvas_item_get_extents (item);
if (region)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]