recorder: Force full stage redraws during recording

Partial redraws can result into artifacts in the recording,
so disable them while recording.

https://bugzilla.gnome.org/show_bug.cgi?id=640206
This commit is contained in:
Adel Gadllah 2011-01-21 18:55:00 +01:00
parent 3b333c37fd
commit d6a6e6220a

View File

@ -83,6 +83,7 @@ struct _ShellRecorder {
guint redraw_idle; guint redraw_idle;
guint update_memory_used_timeout; guint update_memory_used_timeout;
guint update_pointer_timeout; guint update_pointer_timeout;
guint repaint_hook_id;
}; };
struct _RecorderPipeline struct _RecorderPipeline
@ -239,6 +240,22 @@ get_memory_target (void)
return DEFAULT_MEMORY_TARGET; return DEFAULT_MEMORY_TARGET;
} }
/*
* Used to force full stage redraws during recording to avoid artifacts
*
* Note: That this will cause the stage to be repainted on
* every animation frame even if the frame wouldn't normally cause any new
* drawing
*/
static gboolean
recorder_repaint_hook (gpointer data)
{
ClutterActor *stage = data;
clutter_actor_queue_redraw (stage);
return TRUE;
}
static void static void
shell_recorder_init (ShellRecorder *recorder) shell_recorder_init (ShellRecorder *recorder)
{ {
@ -1682,6 +1699,9 @@ shell_recorder_record (ShellRecorder *recorder)
recorder->state = RECORDER_STATE_RECORDING; recorder->state = RECORDER_STATE_RECORDING;
recorder_add_update_pointer_timeout (recorder); recorder_add_update_pointer_timeout (recorder);
/* Set up repaint hook */
recorder->repaint_hook_id = clutter_threads_add_repaint_func(recorder_repaint_hook, recorder->stage, NULL);
/* Record an initial frame and also redraw with the indicator */ /* Record an initial frame and also redraw with the indicator */
clutter_actor_queue_redraw (CLUTTER_ACTOR (recorder->stage)); clutter_actor_queue_redraw (CLUTTER_ACTOR (recorder->stage));
@ -1723,6 +1743,12 @@ shell_recorder_pause (ShellRecorder *recorder)
/* Queue a redraw to remove the recording indicator */ /* Queue a redraw to remove the recording indicator */
clutter_actor_queue_redraw (CLUTTER_ACTOR (recorder->stage)); clutter_actor_queue_redraw (CLUTTER_ACTOR (recorder->stage));
if (recorder->repaint_hook_id != 0)
{
clutter_threads_remove_repaint_func (recorder->repaint_hook_id);
recorder->repaint_hook_id = 0;
}
} }
/** /**