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



commit b73a74c370493ca386d4a5b5c8601efd7f1dfe36
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 620b050..420efd2 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -490,18 +490,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
@@ -562,5 +557,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 358f424..c3afb37 100644
--- a/app/display/gimpdisplayshell-draw.c
+++ b/app/display/gimpdisplayshell-draw.c
@@ -138,6 +138,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]