[gtk+] Add gdk_window_mark_paint_from_clip and call from widget drawing



commit d0147a6f2cbc4903bc6969bde29de7bb068eae71
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Oct 9 10:18:02 2014 +0200

    Add gdk_window_mark_paint_from_clip and call from widget drawing
    
    This is a new function that gets called every time we're drawing
    some area in the Gtk paint machinery. It is a no-op right now, but
    it will be required later to keep track of what areas which
    we previously rendered with GL was overwritten with cairo contents.

 docs/reference/gdk/gdk3-sections.txt |    1 +
 gdk/gdkwindow.c                      |   20 ++++++++++++++++++++
 gdk/gdkwindow.h                      |    3 +++
 gtk/gtkwidget.c                      |    2 ++
 4 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 59d4b33..fd281cf 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -394,6 +394,7 @@ gdk_window_constrain_size
 gdk_window_beep
 gdk_window_get_scale_factor
 gdk_window_set_opaque_region
+gdk_window_mark_paint_from_clip
 
 <SUBSECTION>
 gdk_window_get_clip_region
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index f5c0610..7140070 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -2814,6 +2814,26 @@ gdk_window_begin_paint_region (GdkWindow       *window,
 }
 
 /**
+ * gdk_window_mark_paint_from_clip:
+ * @window: a #GdkWindow
+ * @cr: a #cairo_t
+ *
+ * If you call this during a paint (e.g. between gdk_window_begin_paint_region()
+ * and gdk_window_end_paint() then gdk will mark the current clip region of the
+ * window as being drawn. This is required when mixing GL rendering via
+ * gdk_cairo_draw_from_gl() and cairo rendering, as otherwise gdk has no way
+ * of knowing when something paints over the gl drawn regions.
+ *
+ * This is typically called automatically by Gtk and you don't need
+ * to care about this.
+ **/
+void
+gdk_window_mark_paint_from_clip (GdkWindow          *window,
+                                cairo_t            *cr)
+{
+}
+
+/**
  * gdk_window_end_paint:
  * @window: a #GdkWindow
  *
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 38a67b5..55c5898 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -739,6 +739,9 @@ cairo_region_t *gdk_window_get_visible_region(GdkWindow         *window);
 GDK_AVAILABLE_IN_ALL
 void         gdk_window_begin_paint_rect   (GdkWindow          *window,
                                             const GdkRectangle *rectangle);
+GDK_AVAILABLE_IN_3_14
+void         gdk_window_mark_paint_from_clip (GdkWindow          *window,
+                                              cairo_t            *cr);
 GDK_AVAILABLE_IN_ALL
 void         gdk_window_begin_paint_region (GdkWindow          *window,
                                             const cairo_region_t    *region);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b2d3424..0008519 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6948,6 +6948,8 @@ _gtk_widget_draw_internal (GtkWidget *widget,
     {
       gboolean result;
 
+      gdk_window_mark_paint_from_clip (window, cr);
+
       g_signal_emit (widget, widget_signals[DRAW],
                      0, cr,
                      &result);


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