[gimp] app: some draw tool cleanup
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: some draw tool cleanup
- Date: Mon, 4 Oct 2010 21:32:23 +0000 (UTC)
commit 4151d9f693a1a1f4d3f681300e72711e8656fee7
Author: Michael Natterer <mitch gimp org>
Date: Mon Oct 4 23:31:25 2010 +0200
app: some draw tool cleanup
- call undraw() from draw() instead of duplicating its code
- merge clear_items() into undraw()
app/tools/gimpdrawtool.c | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index 7d4cf12..9e9db00 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -174,27 +174,11 @@ gimp_draw_tool_control (GimpTool *tool,
}
static void
-gimp_draw_tool_clear_items (GimpDrawTool *draw_tool)
-{
- if (draw_tool->item)
- {
- g_object_unref (draw_tool->item);
- draw_tool->item = NULL;
- }
-}
-
-static void
gimp_draw_tool_draw (GimpDrawTool *draw_tool)
{
if (draw_tool->display && draw_tool->paused_count == 0)
{
- GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
-
- if (draw_tool->item)
- {
- gimp_display_shell_remove_item (shell, draw_tool->item);
- gimp_draw_tool_clear_items (draw_tool);
- }
+ gimp_draw_tool_undraw (draw_tool);
GIMP_DRAW_TOOL_GET_CLASS (draw_tool)->draw (draw_tool);
@@ -211,6 +195,8 @@ gimp_draw_tool_draw (GimpDrawTool *draw_tool)
if (draw_tool->item)
{
+ GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
+
gimp_display_shell_add_item (shell, draw_tool->item);
}
}
@@ -224,7 +210,8 @@ gimp_draw_tool_undraw (GimpDrawTool *draw_tool)
GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
gimp_display_shell_remove_item (shell, draw_tool->item);
- gimp_draw_tool_clear_items (draw_tool);
+ g_object_unref (draw_tool->item);
+ draw_tool->item = NULL;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]