[clutter/wip/clip-with-swap-buffers: 2/4] stage-window: make it possible to damage the back buffer



commit eea37c23d37400bfb1fde3257ed7b29dfb9b6501
Author: Robert Bragg <robert linux intel com>
Date:   Wed Mar 23 17:49:20 2011 +0000

    stage-window: make it possible to damage the back buffer
    
    This allows us to report to the backend that the stage's back buffer has
    been trashed while handling picking. If the backend is keeping track of
    the contents of back buffers so it can minimize how much of the stage is
    redrawn then it needs to know when we do pick renders so it can
    invalidate the back buffer.

 clutter/clutter-stage-window.c  |   12 ++++++++++++
 clutter/clutter-stage-window.h  |    4 ++++
 clutter/clutter-stage.c         |    4 ++++
 clutter/glx/clutter-stage-glx.c |    8 ++++++++
 4 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-stage-window.c b/clutter/clutter-stage-window.c
index a438d50..2580bf4 100644
--- a/clutter/clutter-stage-window.c
+++ b/clutter/clutter-stage-window.c
@@ -192,3 +192,15 @@ _clutter_stage_window_redraw (ClutterStageWindow *window)
   if (iface->redraw)
     iface->redraw (window);
 }
+
+void
+_clutter_stage_window_dirty_back_buffer (ClutterStageWindow *window)
+{
+  ClutterStageWindowIface *iface;
+
+  g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
+
+  iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
+  if (iface->dirty_back_buffer)
+    iface->dirty_back_buffer (window);
+}
diff --git a/clutter/clutter-stage-window.h b/clutter/clutter-stage-window.h
index d616d2b..4d642a3 100644
--- a/clutter/clutter-stage-window.h
+++ b/clutter/clutter-stage-window.h
@@ -68,6 +68,8 @@ struct _ClutterStageWindowIface
                                            gboolean            accept_focus);
 
   void          (* redraw)                (ClutterStageWindow *stage_window);
+
+  void          (* dirty_back_buffer)     (ClutterStageWindow *stage_window);
 };
 
 GType clutter_stage_window_get_type (void) G_GNUC_CONST;
@@ -107,6 +109,8 @@ void          _clutter_stage_window_set_accept_focus      (ClutterStageWindow *w
 
 void          _clutter_stage_window_redraw                (ClutterStageWindow *window);
 
+void          _clutter_stage_window_dirty_back_buffer     (ClutterStageWindow *window);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_STAGE_WINDOW_H__ */
diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c
index bb2b345..bf55647 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -1356,6 +1356,10 @@ _clutter_stage_do_pick (ClutterStage   *stage,
   context->pick_mode = CLUTTER_PICK_NONE;
   CLUTTER_TIMER_STOP (_clutter_uprof_context, pick_paint);
 
+  /* Notify the backend that we have trashed the contents of
+   * the back buffer... */
+  _clutter_stage_window_dirty_back_buffer (priv->impl);
+
   if (is_clipped)
     {
       if (G_LIKELY (!(clutter_pick_debug_flags &
diff --git a/clutter/glx/clutter-stage-glx.c b/clutter/glx/clutter-stage-glx.c
index e3442fc..a2ae2da 100644
--- a/clutter/glx/clutter-stage-glx.c
+++ b/clutter/glx/clutter-stage-glx.c
@@ -639,6 +639,13 @@ clutter_stage_glx_redraw (ClutterStageWindow *stage_window)
 }
 
 static void
+clutter_stage_glx_dirty_back_buffer (ClutterStageWindow *stage_window)
+{
+  ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (stage_window);
+  stage_glx->n_old_redraw_clips = 0;
+}
+
+static void
 clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
 {
   clutter_stage_window_parent_iface = g_type_interface_peek_parent (iface);
@@ -651,6 +658,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
   iface->has_redraw_clips = clutter_stage_glx_has_redraw_clips;
   iface->ignoring_redraw_clips = clutter_stage_glx_ignoring_redraw_clips;
   iface->redraw = clutter_stage_glx_redraw;
+  iface->dirty_back_buffer = clutter_stage_glx_dirty_back_buffer;
 
   /* the rest is inherited from ClutterStageX11 */
 }



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