From 654c26a1301c9bc5f8e3e5e3b68af5eb1b2e0673 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 22 May 2009 14:49:37 +0100 Subject: [PATCH 1/2] [actor] In paint when opacity == 0, clear the queued_redraw flag If we are short-circuiting the paint when the opacity is zero we still need to clear the queued_redraw flag otherwise it won't be possible to queue another redraw of the actor until something else has caused a paint first. --- clutter/clutter-actor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index e59270259..675464355 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -1567,7 +1567,10 @@ clutter_actor_paint (ClutterActor *self) * actors with 0 opacity to be a NOP... */ if (G_LIKELY (context->pick_mode == CLUTTER_PICK_NONE) && priv->opacity == 0) - return; + { + priv->queued_redraw = FALSE; + return; + } if (!CLUTTER_ACTOR_IS_REALIZED (self)) { From d960ce46e5fe087bccae2aa9a023fa1a80b76e79 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 28 May 2009 15:27:09 +0100 Subject: [PATCH 2/2] [test-text-perf] Use queue_redraw instead of painting the stage directly If it doesn't queue a redraw and allow the backend to clear and swap the buffers then the results will be skewed because it is not predictable when the driver will actually render the scene. --- tests/micro-bench/test-text-perf.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/micro-bench/test-text-perf.c b/tests/micro-bench/test-text-perf.c index 8c7d0c492..cd8d9056e 100644 --- a/tests/micro-bench/test-text-perf.c +++ b/tests/micro-bench/test-text-perf.c @@ -10,10 +10,9 @@ static int font_size; static int n_chars; static int rows, cols; -gboolean idle (gpointer data) +static void +on_paint (ClutterActor *actor, gconstpointer *data) { - ClutterActor *stage = CLUTTER_ACTOR (data); - static GTimer *timer = NULL; static int fps = 0; @@ -33,8 +32,13 @@ gboolean idle (gpointer data) fps = 0; } - clutter_actor_paint (stage); ++fps; +} + +static gboolean +queue_redraw (gpointer stage) +{ + clutter_actor_queue_redraw (CLUTTER_ACTOR (stage)); return TRUE; } @@ -91,6 +95,8 @@ main (int argc, char *argv[]) clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); + g_signal_connect (stage, "paint", G_CALLBACK (on_paint), NULL); + label = create_label (); w = clutter_actor_get_width (label); h = clutter_actor_get_height (label); @@ -114,7 +120,7 @@ main (int argc, char *argv[]) clutter_actor_show_all (stage); - g_idle_add (idle, (gpointer) stage); + g_idle_add (queue_redraw, stage); clutter_main ();