micro-bench/*: Do not use clutter_stage_get_default()

This commit is contained in:
Emmanuele Bassi 2011-11-08 17:23:52 +00:00
parent a5522b707e
commit 93eb0bfe32
5 changed files with 25 additions and 21 deletions

View File

@ -23,6 +23,7 @@ static GOptionEntry entries[] = {
typedef struct _TestState
{
ClutterActor *stage;
int current_test;
} TestState;
@ -89,8 +90,6 @@ test_rectangles (TestState *state)
cogl_pop_matrix ();
}
}
}
TestCallback tests[] =
@ -117,8 +116,6 @@ main (int argc, char *argv[])
{
TestState state;
ClutterActor *stage;
ClutterColor stage_clr = {0x0, 0x0, 0x0, 0xff};
guint idle_source;
GError *error = NULL;
g_setenv ("CLUTTER_VBLANK", "none", FALSE);
@ -139,13 +136,14 @@ main (int argc, char *argv[])
state.current_test = 0;
stage = clutter_stage_get_default ();
state.stage = stage = clutter_stage_new ();
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_White);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Performance Test");
/* We want continuous redrawing of the stage... */
idle_source = g_idle_add (queue_redraw, stage);
clutter_threads_add_idle (queue_redraw, stage);
g_signal_connect_after (stage, "paint", G_CALLBACK (on_paint), &state);
@ -153,7 +151,7 @@ main (int argc, char *argv[])
clutter_main ();
g_source_remove (idle_source);
clutter_actor_destroy (stage);
return 0;
}

View File

@ -72,7 +72,6 @@ main (int argc, char **argv)
{
glong i;
gdouble angle;
const ClutterColor black = { 0x00, 0x00, 0x00, 0xff };
ClutterColor color = { 0x00, 0x00, 0x00, 0xff };
ClutterActor *stage, *rect;
GError *error = NULL;
@ -88,9 +87,10 @@ main (int argc, char **argv)
&error) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
stage = clutter_stage_new ();
clutter_actor_set_size (stage, 512, 512);
clutter_stage_set_color (CLUTTER_STAGE (stage), &black);
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Picking");
printf ("Picking performance test with "
"%d actors and %d events per frame\n",
@ -126,12 +126,14 @@ main (int argc, char **argv)
clutter_actor_show (stage);
g_idle_add (queue_redraw, stage);
clutter_threads_add_idle (queue_redraw, stage);
g_signal_connect (stage, "paint", G_CALLBACK (on_paint), NULL);
clutter_main ();
clutter_actor_destroy (stage);
return 0;
}

View File

@ -90,7 +90,8 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Random Text");
clutter_actor_show (stage);
@ -98,5 +99,7 @@ main (int argc, char *argv[])
clutter_main ();
clutter_actor_destroy (stage);
return 0;
}

View File

@ -105,7 +105,6 @@ int
main (int argc, char *argv[])
{
ClutterActor *stage;
ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
ClutterActor *label;
int w, h;
int row, col;
@ -128,9 +127,10 @@ main (int argc, char *argv[])
g_print ("Monospace %dpx, string length = %d\n", font_size, n_chars);
stage = clutter_stage_get_default ();
stage = clutter_stage_new ();
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Text Performance");
g_signal_connect (stage, "paint", G_CALLBACK (on_paint), NULL);

View File

@ -43,8 +43,6 @@ int
main (int argc, char *argv[])
{
ClutterActor *stage;
ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
ClutterColor label_color = { 0xff, 0xff, 0xff, 0xff };
ClutterActor *group;
g_setenv ("CLUTTER_VBLANK", "none", FALSE);
@ -53,9 +51,10 @@ main (int argc, char *argv[])
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_get_default ();
stage = clutter_stage_new ();
clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
clutter_stage_set_title (CLUTTER_STAGE (stage), "Text");
group = clutter_group_new ();
clutter_actor_set_size (group, STAGE_WIDTH, STAGE_WIDTH);
@ -98,7 +97,7 @@ main (int argc, char *argv[])
}
label = clutter_text_new_with_text (font_name, text);
clutter_text_set_color (CLUTTER_TEXT (label), &label_color);
clutter_text_set_color (CLUTTER_TEXT (label), CLUTTER_COLOR_White);
clutter_actor_set_position (label, (1.0*STAGE_WIDTH/COLS)*col,
(1.0*STAGE_HEIGHT/ROWS)*row);
/*clutter_actor_set_clip (label, 0,0, (1.0*STAGE_WIDTH/COLS),
@ -115,5 +114,7 @@ main (int argc, char *argv[])
clutter_main();
clutter_actor_destroy (stage);
return 0;
}