[gimp] app: move clearing and invalidating canvas items to utility functions
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move clearing and invalidating canvas items to utility functions
- Date: Fri, 24 Sep 2010 19:25:34 +0000 (UTC)
commit 5d14e9befcb3f31886706b7210d437e67e94c7cd
Author: Michael Natterer <mitch gimp org>
Date: Fri Sep 24 21:25:01 2010 +0200
app: move clearing and invalidating canvas items to utility functions
app/tools/gimpdrawtool.c | 72 +++++++++++++++++++++-------------------------
1 files changed, 33 insertions(+), 39 deletions(-)
---
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index 7c253b6..8eb2311 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -170,33 +170,45 @@ gimp_draw_tool_control (GimpTool *tool,
}
static void
+gimp_draw_tool_invalidate_items (GimpDrawTool *draw_tool)
+{
+ GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
+ GdkWindow *window = gtk_widget_get_window (shell->canvas);
+ GList *list;
+
+ for (list = draw_tool->items; list; list = g_list_next (list))
+ {
+ GimpCanvasItem *item = list->data;
+ GdkRegion *region;
+
+ region = gimp_canvas_item_get_extents (item, shell);
+ gdk_window_invalidate_region (window, region, TRUE);
+ gdk_region_destroy (region);
+ }
+}
+
+static void
+gimp_draw_tool_clear_items (GimpDrawTool *draw_tool)
+{
+ if (draw_tool->items)
+ {
+ g_list_foreach (draw_tool->items, (GFunc) g_object_unref, NULL);
+ g_list_free (draw_tool->items);
+ draw_tool->items = NULL;
+ }
+}
+
+static void
gimp_draw_tool_draw (GimpDrawTool *draw_tool)
{
if (draw_tool->paused_count == 0 &&
draw_tool->display)
{
- GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
- GdkWindow *window = gtk_widget_get_window (shell->canvas);
- GList *list;
-
- if (draw_tool->items)
- {
- g_list_foreach (draw_tool->items, (GFunc) g_object_unref, NULL);
- g_list_free (draw_tool->items);
- draw_tool->items = NULL;
- }
+ gimp_draw_tool_clear_items (draw_tool);
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool);
- for (list = draw_tool->items; list; list = g_list_next (list))
- {
- GimpCanvasItem *item = list->data;
- GdkRegion *region;
-
- region = gimp_canvas_item_get_extents (item, shell);
- gdk_window_invalidate_region (window, region, TRUE);
- gdk_region_destroy (region);
- }
+ gimp_draw_tool_invalidate_items (draw_tool);
draw_tool->is_drawn = TRUE;
}
@@ -208,26 +220,8 @@ gimp_draw_tool_undraw (GimpDrawTool *draw_tool)
if (draw_tool->paused_count == 0 &&
draw_tool->display)
{
- GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
- GdkWindow *window = gtk_widget_get_window (shell->canvas);
- GList *list;
-
- for (list = draw_tool->items; list; list = g_list_next (list))
- {
- GimpCanvasItem *item = list->data;
- GdkRegion *region;
-
- region = gimp_canvas_item_get_extents (item, shell);
- gdk_window_invalidate_region (window, region, TRUE);
- gdk_region_destroy (region);
- }
-
- if (draw_tool->items)
- {
- g_list_foreach (draw_tool->items, (GFunc) g_object_unref, NULL);
- g_list_free (draw_tool->items);
- draw_tool->items = NULL;
- }
+ gimp_draw_tool_invalidate_items (draw_tool);
+ gimp_draw_tool_clear_items (draw_tool);
draw_tool->is_drawn = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]