summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2011-03-23 17:49:20 +0000
committerRobert Bragg <robert@linux.intel.com>2011-04-01 17:26:29 +0100
commiteea37c23d37400bfb1fde3257ed7b29dfb9b6501 (patch)
tree657ffd1eb8a2f1f3deb981e50b2a21ab67f59913
parent8c48074a5892b77421bfc4b49ac3c29780232a95 (diff)
downloadclutter-eea37c23d37400bfb1fde3257ed7b29dfb9b6501.tar.gz
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.
-rw-r--r--clutter/clutter-stage-window.c12
-rw-r--r--clutter/clutter-stage-window.h4
-rw-r--r--clutter/clutter-stage.c4
-rw-r--r--clutter/glx/clutter-stage-glx.c8
4 files changed, 28 insertions, 0 deletions
diff --git a/clutter/clutter-stage-window.c b/clutter/clutter-stage-window.c
index a438d5098..2580bf4ab 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 d616d2b11..4d642a319 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 bb2b3456a..bf5564707 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 e3442fc00..a2ae2dabe 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 */
}