[clutter/wip/wayland: 1/3] stage-window: make it possible to damage the back buffer



commit 92f494d6b71bd71d36afe5f81c591bda36f45d27
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/cogl/clutter-stage-cogl.c |    8 ++++++++
 4 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-stage-window.c b/clutter/clutter-stage-window.c
index 1b35103..2981adb 100644
--- a/clutter/clutter-stage-window.c
+++ b/clutter/clutter-stage-window.c
@@ -267,3 +267,15 @@ _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
 
   return FALSE;
 }
+
+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 3d82f5c..dbe2e82 100644
--- a/clutter/clutter-stage-window.h
+++ b/clutter/clutter-stage-window.h
@@ -89,6 +89,8 @@ struct _ClutterStageWindowIface
   CoglFramebuffer  *(* get_active_framebuffer)  (ClutterStageWindow *stage_window);
 
   gboolean          (* can_clip_redraws)        (ClutterStageWindow *stage_window);
+
+  void              (* dirty_back_buffer)       (ClutterStageWindow *stage_window);
 };
 
 GType clutter_stage_window_get_type (void) G_GNUC_CONST;
@@ -134,6 +136,8 @@ CoglFramebuffer  *_clutter_stage_window_get_active_framebuffer  (ClutterStageWin
 
 gboolean          _clutter_stage_window_can_clip_redraws        (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 a9ab25a..80bd1c0 100644
--- a/clutter/clutter-stage.c
+++ b/clutter/clutter-stage.c
@@ -1494,6 +1494,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/cogl/clutter-stage-cogl.c b/clutter/cogl/clutter-stage-cogl.c
index 618723a..a18dd7c 100644
--- a/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/cogl/clutter-stage-cogl.c
@@ -520,6 +520,13 @@ clutter_stage_cogl_get_active_framebuffer (ClutterStageWindow *stage_window)
 }
 
 static void
+clutter_stage_cogl_dirty_back_buffer (ClutterStageWindow *stage_window)
+{
+  ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
+  stage_cogl->n_old_redraw_clips = 0;
+}
+
+static void
 clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
 {
   iface->realize = clutter_stage_cogl_realize;
@@ -536,6 +543,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
   iface->get_redraw_clip_bounds = clutter_stage_cogl_get_redraw_clip_bounds;
   iface->redraw = clutter_stage_cogl_redraw;
   iface->get_active_framebuffer = clutter_stage_cogl_get_active_framebuffer;
+  iface->dirty_back_buffer = clutter_stage_cogl_dirty_back_buffer;
 }
 
 static void



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