[gimp] app: add gimp_display_shell_expose_item() and use it in the draw tool



commit ebeb9333506c987e10ec512b7fa92b5f79ccf853
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 29 20:10:21 2010 +0200

    app: add gimp_display_shell_expose_item() and use it in the draw tool

 app/display/gimpdisplayshell-expose.c |   22 ++++++++++++++++++++++
 app/display/gimpdisplayshell-expose.h |    2 ++
 app/tools/gimpdrawtool.c              |   13 +++----------
 3 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-expose.c b/app/display/gimpdisplayshell-expose.c
index c59805a..6603f7e 100644
--- a/app/display/gimpdisplayshell-expose.c
+++ b/app/display/gimpdisplayshell-expose.c
@@ -29,6 +29,7 @@
 
 #include "vectors/gimpvectors.h"
 
+#include "gimpcanvasitem.h"
 #include "gimpdisplayshell.h"
 #include "gimpdisplayshell-expose.h"
 #include "gimpdisplayshell-transform.h"
@@ -67,6 +68,27 @@ gimp_display_shell_expose_region (GimpDisplayShell *shell,
 }
 
 void
+gimp_display_shell_expose_item (GimpDisplayShell *shell,
+                                GimpCanvasItem   *item)
+{
+  GdkWindow *window;
+  GdkRegion *region;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+  g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
+
+  window = gtk_widget_get_window (shell->canvas);
+
+  region = gimp_canvas_item_get_extents (item, shell);
+
+  if (region)
+    {
+      gdk_window_invalidate_region (window, region, TRUE);
+      gdk_region_destroy (region);
+    }
+}
+
+void
 gimp_display_shell_expose_guide (GimpDisplayShell *shell,
                                  GimpGuide        *guide)
 {
diff --git a/app/display/gimpdisplayshell-expose.h b/app/display/gimpdisplayshell-expose.h
index 44b7368..5546097 100644
--- a/app/display/gimpdisplayshell-expose.h
+++ b/app/display/gimpdisplayshell-expose.h
@@ -24,6 +24,8 @@ void        gimp_display_shell_expose_area         (GimpDisplayShell   *shell,
                                                     gint                y,
                                                     gint                w,
                                                     gint                h);
+void        gimp_display_shell_expose_item         (GimpDisplayShell   *shell,
+                                                    GimpCanvasItem     *item);
 void        gimp_display_shell_expose_guide        (GimpDisplayShell   *shell,
                                                     GimpGuide          *guide);
 void        gimp_display_shell_expose_sample_point (GimpDisplayShell   *shell,
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index dbb249c..285482f 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -45,6 +45,7 @@
 #include "display/gimpcanvastextcursor.h"
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
+#include "display/gimpdisplayshell-expose.h"
 #include "display/gimpdisplayshell-transform.h"
 
 #include "gimpdrawtool.h"
@@ -184,17 +185,9 @@ gimp_draw_tool_invalidate_items (GimpDrawTool *draw_tool)
 {
   if (draw_tool->item)
     {
-      GimpDisplayShell *shell  = gimp_display_get_shell (draw_tool->display);
-      GdkWindow        *window = gtk_widget_get_window (shell->canvas);
-      GdkRegion        *region;
-
-      region = gimp_canvas_item_get_extents (draw_tool->item, shell);
+      GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
 
-      if (region)
-        {
-          gdk_window_invalidate_region (window, region, TRUE);
-          gdk_region_destroy (region);
-        }
+      gimp_display_shell_expose_item (shell, draw_tool->item);
     }
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]