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.

Based on patch from Robert Bragg <robert@linux.intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=669122
This commit is contained in:
Adel Gadllah 2013-02-03 11:51:19 +01:00
parent c0469601c7
commit 60f20e8a7e
5 changed files with 34 additions and 0 deletions

View File

@ -236,6 +236,18 @@ _clutter_stage_window_redraw (ClutterStageWindow *window)
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);
}
/* NB: The presumption shouldn't be that a stage can't be comprised of
* multiple internal framebuffers, so instead of simply naming this
* function _clutter_stage_window_get_framebuffer(), the "active"

View File

@ -73,6 +73,8 @@ struct _ClutterStageWindowIface
void (* redraw) (ClutterStageWindow *stage_window);
void (* dirty_back_buffer) (ClutterStageWindow *stage_window);
CoglFramebuffer *(* get_active_framebuffer) (ClutterStageWindow *stage_window);
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
@ -117,6 +119,8 @@ void _clutter_stage_window_set_accept_focus (ClutterStageWin
void _clutter_stage_window_redraw (ClutterStageWindow *window);
void _clutter_stage_window_dirty_back_buffer (ClutterStageWindow *window);
CoglFramebuffer *_clutter_stage_window_get_active_framebuffer (ClutterStageWindow *window);
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);

View File

@ -1522,6 +1522,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 &

View File

@ -502,6 +502,9 @@ clutter_stage_cogl_redraw (ClutterStageWindow *stage_window)
/* reset the redraw clipping for the next paint... */
stage_cogl->initialized_redraw_clip = FALSE;
/* We have repaired the backbuffer */
stage_cogl->dirty_backbuffer = FALSE;
stage_cogl->frame_count++;
}
@ -513,6 +516,14 @@ clutter_stage_cogl_get_active_framebuffer (ClutterStageWindow *stage_window)
return COGL_FRAMEBUFFER (stage_cogl->onscreen);
}
static void
clutter_stage_cogl_dirty_back_buffer (ClutterStageWindow *stage_window)
{
ClutterStageCogl *stage_cogl = CLUTTER_STAGE_COGL (stage_window);
stage_cogl->dirty_backbuffer = TRUE;
}
static void
clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
{
@ -530,6 +541,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

View File

@ -50,6 +50,8 @@ struct _ClutterStageCogl
/* TRUE if the current paint cycle has a clipped redraw. In that
case bounding_redraw_clip specifies the the bounds. */
guint using_clipped_redraw : 1;
guint dirty_backbuffer : 1;
};
struct _ClutterStageCoglClass