Commit d3f19baf authored by Michael Natterer's avatar Michael Natterer 😴

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.
parent 33ab9451
...@@ -279,9 +279,9 @@ gimp_canvas_arc_draw (GimpCanvasItem *item, ...@@ -279,9 +279,9 @@ gimp_canvas_arc_draw (GimpCanvasItem *item,
cairo_restore (cr); cairo_restore (cr);
if (private->filled) if (private->filled)
_gimp_canvas_item_fill (item, shell, cr); _gimp_canvas_item_fill (item, cr);
else else
_gimp_canvas_item_stroke (item, shell, cr); _gimp_canvas_item_stroke (item, cr);
} }
static GdkRegion * static GdkRegion *
......
...@@ -242,7 +242,7 @@ gimp_canvas_boundary_draw (GimpCanvasItem *item, ...@@ -242,7 +242,7 @@ gimp_canvas_boundary_draw (GimpCanvasItem *item,
gimp_cairo_add_segments (cr, segs, private->n_segs); 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); g_free (segs);
} }
......
...@@ -405,7 +405,7 @@ gimp_canvas_corner_draw (GimpCanvasItem *item, ...@@ -405,7 +405,7 @@ gimp_canvas_corner_draw (GimpCanvasItem *item,
cairo_rectangle (cr, x, y, w, h); cairo_rectangle (cr, x, y, w, h);
_gimp_canvas_item_stroke (item, shell, cr); _gimp_canvas_item_stroke (item, cr);
} }
static GdkRegion * static GdkRegion *
......
...@@ -185,14 +185,14 @@ gimp_canvas_group_draw (GimpCanvasItem *item, ...@@ -185,14 +185,14 @@ gimp_canvas_group_draw (GimpCanvasItem *item,
{ {
GimpCanvasItem *sub_item = list->data; GimpCanvasItem *sub_item = list->data;
gimp_canvas_item_draw (sub_item, shell, cr); gimp_canvas_item_draw (sub_item, cr);
} }
if (private->group_stroking) if (private->group_stroking)
_gimp_canvas_item_stroke (item, shell, cr); _gimp_canvas_item_stroke (item, cr);
if (private->group_filling) if (private->group_filling)
_gimp_canvas_item_fill (item, shell, cr); _gimp_canvas_item_fill (item, cr);
} }
static GdkRegion * static GdkRegion *
...@@ -206,8 +206,7 @@ gimp_canvas_group_get_extents (GimpCanvasItem *item, ...@@ -206,8 +206,7 @@ gimp_canvas_group_get_extents (GimpCanvasItem *item,
for (list = private->items; list; list = g_list_next (list)) for (list = private->items; list; list = g_list_next (list))
{ {
GimpCanvasItem *sub_item = list->data; GimpCanvasItem *sub_item = list->data;
GdkRegion *sub_region = gimp_canvas_item_get_extents (sub_item, GdkRegion *sub_region = gimp_canvas_item_get_extents (sub_item);
shell);
if (! region) if (! region)
{ {
......
...@@ -223,7 +223,7 @@ gimp_canvas_guide_draw (GimpCanvasItem *item, ...@@ -223,7 +223,7 @@ gimp_canvas_guide_draw (GimpCanvasItem *item,
cairo_move_to (cr, x1, y1); cairo_move_to (cr, x1, y1);
cairo_line_to (cr, x2, y2); cairo_line_to (cr, x2, y2);
_gimp_canvas_item_stroke (item, shell, cr); _gimp_canvas_item_stroke (item, cr);
} }
static GdkRegion * static GdkRegion *
......
...@@ -425,13 +425,13 @@ gimp_canvas_handle_draw (GimpCanvasItem *item, ...@@ -425,13 +425,13 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
case GIMP_HANDLE_SQUARE: case GIMP_HANDLE_SQUARE:
cairo_rectangle (cr, x, y, private->width - 1.0, private->height - 1.0); 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; break;
case GIMP_HANDLE_FILLED_SQUARE: case GIMP_HANDLE_FILLED_SQUARE:
cairo_rectangle (cr, x - 0.5, y - 0.5, private->width, private->height); 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; break;
case GIMP_HANDLE_CIRCLE: case GIMP_HANDLE_CIRCLE:
...@@ -439,7 +439,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item, ...@@ -439,7 +439,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
private->start_angle, private->start_angle,
private->slice_angle); private->slice_angle);
_gimp_canvas_item_stroke (item, shell, cr); _gimp_canvas_item_stroke (item, cr);
break; break;
case GIMP_HANDLE_FILLED_CIRCLE: case GIMP_HANDLE_FILLED_CIRCLE:
...@@ -449,7 +449,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item, ...@@ -449,7 +449,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
private->start_angle, private->start_angle,
private->slice_angle); private->slice_angle);
_gimp_canvas_item_fill (item, shell, cr); _gimp_canvas_item_fill (item, cr);
break; break;
case GIMP_HANDLE_CROSS: case GIMP_HANDLE_CROSS:
...@@ -459,7 +459,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item, ...@@ -459,7 +459,7 @@ gimp_canvas_handle_draw (GimpCanvasItem *item,
cairo_move_to (cr, x, y - private->height / 2); cairo_move_to (cr, x, y - private->height / 2);
cairo_line_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; break;
default: default:
......
...@@ -253,28 +253,32 @@ gimp_canvas_item_real_fill (GimpCanvasItem *item, ...@@ -253,28 +253,32 @@ gimp_canvas_item_real_fill (GimpCanvasItem *item,
void void
gimp_canvas_item_draw (GimpCanvasItem *item, gimp_canvas_item_draw (GimpCanvasItem *item,
GimpDisplayShell *shell,
cairo_t *cr) cairo_t *cr)
{ {
GimpCanvasItemPrivate *private;
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item)); g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL); g_return_if_fail (cr != NULL);
private = GET_PRIVATE (item);
cairo_save (cr); 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); cairo_restore (cr);
} }
GdkRegion * GdkRegion *
gimp_canvas_item_get_extents (GimpCanvasItem *item, gimp_canvas_item_get_extents (GimpCanvasItem *item)
GimpDisplayShell *shell)
{ {
GimpCanvasItemPrivate *private;
g_return_val_if_fail (GIMP_IS_CANVAS_ITEM (item), NULL); 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 void
...@@ -368,7 +372,6 @@ gimp_canvas_item_resume_filling (GimpCanvasItem *item) ...@@ -368,7 +372,6 @@ gimp_canvas_item_resume_filling (GimpCanvasItem *item)
void void
_gimp_canvas_item_stroke (GimpCanvasItem *item, _gimp_canvas_item_stroke (GimpCanvasItem *item,
GimpDisplayShell *shell,
cairo_t *cr) cairo_t *cr)
{ {
GimpCanvasItemPrivate *private = GET_PRIVATE (item); GimpCanvasItemPrivate *private = GET_PRIVATE (item);
...@@ -378,7 +381,7 @@ _gimp_canvas_item_stroke (GimpCanvasItem *item, ...@@ -378,7 +381,7 @@ _gimp_canvas_item_stroke (GimpCanvasItem *item,
if (private->suspend_stroking == 0) 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 else
{ {
...@@ -388,7 +391,6 @@ _gimp_canvas_item_stroke (GimpCanvasItem *item, ...@@ -388,7 +391,6 @@ _gimp_canvas_item_stroke (GimpCanvasItem *item,
void void
_gimp_canvas_item_fill (GimpCanvasItem *item, _gimp_canvas_item_fill (GimpCanvasItem *item,
GimpDisplayShell *shell,
cairo_t *cr) cairo_t *cr)
{ {
GimpCanvasItemPrivate *private = GET_PRIVATE (item); GimpCanvasItemPrivate *private = GET_PRIVATE (item);
...@@ -398,7 +400,7 @@ _gimp_canvas_item_fill (GimpCanvasItem *item, ...@@ -398,7 +400,7 @@ _gimp_canvas_item_fill (GimpCanvasItem *item,
if (private->suspend_filling == 0) 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 else
{ {
......
...@@ -62,10 +62,8 @@ struct _GimpCanvasItemClass ...@@ -62,10 +62,8 @@ struct _GimpCanvasItemClass
GType gimp_canvas_item_get_type (void) G_GNUC_CONST; GType gimp_canvas_item_get_type (void) G_GNUC_CONST;
void gimp_canvas_item_draw (GimpCanvasItem *item, void gimp_canvas_item_draw (GimpCanvasItem *item,
GimpDisplayShell *shell,
cairo_t *cr); cairo_t *cr);
GdkRegion * gimp_canvas_item_get_extents (GimpCanvasItem *item, GdkRegion * gimp_canvas_item_get_extents (GimpCanvasItem *item);
GimpDisplayShell *shell);
void gimp_canvas_item_set_line_cap (GimpCanvasItem *item, void gimp_canvas_item_set_line_cap (GimpCanvasItem *item,
cairo_line_cap_t line_cap); cairo_line_cap_t line_cap);
...@@ -84,10 +82,8 @@ void gimp_canvas_item_resume_filling (GimpCanvasItem *item); ...@@ -84,10 +82,8 @@ void gimp_canvas_item_resume_filling (GimpCanvasItem *item);
/* protected */ /* protected */
void _gimp_canvas_item_stroke (GimpCanvasItem *item, void _gimp_canvas_item_stroke (GimpCanvasItem *item,
GimpDisplayShell *shell,
cairo_t *cr); cairo_t *cr);
void _gimp_canvas_item_fill (GimpCanvasItem *item, void _gimp_canvas_item_fill (GimpCanvasItem *item,
GimpDisplayShell *shell,
cairo_t *cr); cairo_t *cr);
......
...@@ -219,7 +219,7 @@ gimp_canvas_line_draw (GimpCanvasItem *item, ...@@ -219,7 +219,7 @@ gimp_canvas_line_draw (GimpCanvasItem *item,
cairo_move_to (cr, x1, y1); cairo_move_to (cr, x1, y1);
cairo_line_to (cr, x2, y2); cairo_line_to (cr, x2, y2);
_gimp_canvas_item_stroke (item, shell, cr); _gimp_canvas_item_stroke (item, cr);
} }
static GdkRegion * static GdkRegion *
......
...@@ -213,9 +213,9 @@ gimp_canvas_polygon_draw (GimpCanvasItem *item, ...@@ -213,9 +213,9 @@ gimp_canvas_polygon_draw (GimpCanvasItem *item,
} }
if (private->filled) if (private->filled)
_gimp_canvas_item_fill (item, shell, cr); _gimp_canvas_item_fill (item, cr);
else else
_gimp_canvas_item_stroke (item, shell, cr); _gimp_canvas_item_stroke (item, cr);
g_free (points); g_free (points);
} }
......
...@@ -253,9 +253,9 @@ gimp_canvas_rectangle_draw (GimpCanvasItem *item, ...@@ -253,9 +253,9 @@ gimp_canvas_rectangle_draw (GimpCanvasItem *item,
cairo_rectangle (cr, x, y, w, h); cairo_rectangle (cr, x, y, w, h);
if (private->filled) if (private->filled)
_gimp_canvas_item_fill (item, shell, cr); _gimp_canvas_item_fill (item, cr);
else else
_gimp_canvas_item_stroke (item, shell, cr); _gimp_canvas_item_stroke (item, cr);
} }
static GdkRegion * static GdkRegion *
......
...@@ -246,7 +246,7 @@ gimp_canvas_sample_point_draw (GimpCanvasItem *item, ...@@ -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); 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), layout = gimp_canvas_get_layout (GIMP_CANVAS (shell->canvas),
"%d", private->index); "%d", private->index);
...@@ -254,7 +254,7 @@ gimp_canvas_sample_point_draw (GimpCanvasItem *item, ...@@ -254,7 +254,7 @@ gimp_canvas_sample_point_draw (GimpCanvasItem *item,
cairo_move_to (cr, x + 2.5, y + 2.5); cairo_move_to (cr, x + 2.5, y + 2.5);
pango_cairo_show_layout (cr, layout); pango_cairo_show_layout (cr, layout);
_gimp_canvas_item_fill (item, shell, cr); _gimp_canvas_item_fill (item, cr);
} }
static GdkRegion * static GdkRegion *
......
...@@ -261,7 +261,7 @@ gimp_canvas_text_cursor_draw (GimpCanvasItem *item, ...@@ -261,7 +261,7 @@ gimp_canvas_text_cursor_draw (GimpCanvasItem *item,
cairo_line_to (cr, x + 3.0, y + h); cairo_line_to (cr, x + 3.0, y + h);
} }
_gimp_canvas_item_stroke (item, shell, cr); _gimp_canvas_item_stroke (item, cr);
} }
static GdkRegion * static GdkRegion *
......
...@@ -2342,7 +2342,7 @@ gimp_display_shell_canvas_expose_image (GimpDisplayShell *shell, ...@@ -2342,7 +2342,7 @@ gimp_display_shell_canvas_expose_image (GimpDisplayShell *shell,
/* draw canvas items */ /* draw canvas items */
cairo_save (cr); cairo_save (cr);
gimp_canvas_item_draw (shell->canvas_item, shell, cr); gimp_canvas_item_draw (shell->canvas_item, cr);
cairo_restore (cr); cairo_restore (cr);
/* and the cursor (if we have a software cursor) */ /* and the cursor (if we have a software cursor) */
......
...@@ -73,7 +73,7 @@ gimp_display_shell_expose_item (GimpDisplayShell *shell, ...@@ -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_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item)); 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) if (region)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment