[gimp/gtk3-port: 92/137] app: fix display shell background drawing



commit c63ee9a48292d0800b29628efe0e459ab4b33123
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 ccf3e40..d7e8f5d 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -2275,18 +2275,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
@@ -2352,5 +2347,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 af27310..f64e86b 100644
--- a/app/display/gimpdisplayshell-draw.c
+++ b/app/display/gimpdisplayshell-draw.c
@@ -147,6 +147,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]