[gimp/gtk3-port: 62/228] app: fix display shell background drawing



commit 0a208f983156527284fdab5b3ca52e39fd30462b
Author: Michael Natterer <mitch gimp org>
Date:   Wed Oct 20 13:53:07 2010 +0200

    app: fix display shell background drawing

 app/display/gimpdisplayshell-callbacks.c |   17 +++++++----------
 app/display/gimpdisplayshell-draw.c      |   17 +++++++++++++++++
 app/display/gimpdisplayshell-draw.h      |    2 ++
 3 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index c5675d0..c9a8cf1 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -487,18 +487,13 @@ gimp_display_shell_canvas_draw_image (GimpDisplayShell *shell,
 
   if (! cairo_region_is_empty (clear_region))
     {
-#if 0
-      gdk_region_get_rectangles (clear_region, &rects, &n_rects);
+      cairo_save (cr);
 
-      for (i = 0; i < n_rects; i++)
-        gdk_window_clear_area (gtk_widget_get_window (shell->canvas),
-                               rects[i].x,
-                               rects[i].y,
-                               rects[i].width,
-                               rects[i].height);
+      gdk_cairo_region (cr, clear_region);
+      cairo_clip (cr);
+      gimp_display_shell_draw_background (shell, cr);
 
-      g_free (rects);
-#endif
+      cairo_restore (cr);
     }
 
   /*  then, draw the exposed part of the region that is inside the
@@ -559,5 +554,7 @@ static void
 gimp_display_shell_canvas_draw_drop_zone (GimpDisplayShell *shell,
                                           cairo_t          *cr)
 {
+  gimp_display_shell_draw_background (shell, cr);
+
   gimp_cairo_draw_drop_wilber (shell->canvas, cr);
 }
diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c
index b0a56de..4384262 100644
--- a/app/display/gimpdisplayshell-draw.c
+++ b/app/display/gimpdisplayshell-draw.c
@@ -137,6 +137,23 @@ gimp_display_shell_draw_selection_in (GimpDisplayShell   *shell,
 }
 
 void
+gimp_display_shell_draw_background (GimpDisplayShell *shell,
+                                    cairo_t          *cr)
+{
+  GdkWindow       *window;
+  cairo_pattern_t *bg_pattern;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+  g_return_if_fail (cr != NULL);
+
+  window     = gtk_widget_get_window (shell->canvas);
+  bg_pattern = gdk_window_get_background_pattern (window);
+
+  cairo_set_source (cr, bg_pattern);
+  cairo_paint (cr);
+}
+
+void
 gimp_display_shell_draw_image (GimpDisplayShell *shell,
                                cairo_t          *cr,
                                gint              x,
diff --git a/app/display/gimpdisplayshell-draw.h b/app/display/gimpdisplayshell-draw.h
index 09aecbc..206894e 100644
--- a/app/display/gimpdisplayshell-draw.h
+++ b/app/display/gimpdisplayshell-draw.h
@@ -37,6 +37,8 @@ void   gimp_display_shell_draw_selection_in          (GimpDisplayShell   *shell,
                                                       cairo_pattern_t    *mask,
                                                       gint                index);
 
+void   gimp_display_shell_draw_background            (GimpDisplayShell   *shell,
+                                                      cairo_t            *cr);
 void   gimp_display_shell_draw_image                 (GimpDisplayShell   *shell,
                                                       cairo_t            *cr,
                                                       gint                x,



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