[clutter/deprecate-default-stage: 6/12] performance/*: Do not use clutter_stage_get_default()



commit fdc5f624aeb37b0066ea88e937608c216d36f411
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Wed Nov 9 13:52:03 2011 +0000

    performance/*: Do not use clutter_stage_get_default()

 tests/performance/test-picking.c           |    9 +++++----
 tests/performance/test-state-hidden.c      |    7 ++++---
 tests/performance/test-state-interactive.c |    6 +++---
 tests/performance/test-state-mini.c        |    7 ++++---
 tests/performance/test-state-pick.c        |    7 ++++---
 tests/performance/test-state.c             |    7 ++++---
 tests/performance/test-text-perf.c         |    4 +++-
 7 files changed, 27 insertions(+), 20 deletions(-)
---
diff --git a/tests/performance/test-picking.c b/tests/performance/test-picking.c
index 9362d35..3432166 100644
--- a/tests/performance/test-picking.c
+++ b/tests/performance/test-picking.c
@@ -67,7 +67,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;
 
@@ -84,9 +83,11 @@ main (int argc, char **argv)
       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 Performance");
+  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
 
   printf ("Picking performance test with "
           "%d actors and %d events per frame\n",
@@ -123,7 +124,7 @@ main (int argc, char **argv)
   clutter_actor_show (stage);
 
   clutter_perf_fps_start (CLUTTER_STAGE (stage));
-  g_idle_add  (queue_redraw, (gpointer)stage);
+  clutter_threads_add_idle (queue_redraw, stage);
   clutter_main ();
   clutter_perf_fps_report ("test-picking");
 
diff --git a/tests/performance/test-state-hidden.c b/tests/performance/test-state-hidden.c
index 699beff..64911b4 100644
--- a/tests/performance/test-state-hidden.c
+++ b/tests/performance/test-state-hidden.c
@@ -53,7 +53,6 @@ gint
 main (gint    argc,
       gchar **argv)
 {
-  ClutterColor  black={0,0,0,0xff};
   ClutterActor *stage;
   ClutterActor *group;
   ClutterState *layout_state;
@@ -63,11 +62,13 @@ main (gint    argc,
   if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
     g_error ("Failed to initialize Clutter");
 
-  stage = clutter_stage_get_default ();
+  stage = clutter_stage_new ();
   group = clutter_group_new ();
   layout_state = clutter_state_new ();
-  clutter_stage_set_color (CLUTTER_STAGE (stage), &black);
+  clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [hidden]");
+  clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
   clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
+  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
 
   for (i=0; i<TOTAL; i++)
     {
diff --git a/tests/performance/test-state-interactive.c b/tests/performance/test-state-interactive.c
index b26b67d..3757835 100644
--- a/tests/performance/test-state-interactive.c
+++ b/tests/performance/test-state-interactive.c
@@ -93,7 +93,6 @@ gint
 main (gint    argc,
       gchar **argv)
 {
-  ClutterColor  black={0,0,0,0xff};
   ClutterActor *stage;
   ClutterState *layout_state;
   gint i;
@@ -101,9 +100,10 @@ main (gint    argc,
   if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
     g_error ("Failed to initialize Clutter");
 
-  stage = clutter_stage_get_default ();
+  stage = clutter_stage_new ();
   layout_state = clutter_state_new ();
-  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), "State Performance [interactive]");
   clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
 
   g_signal_connect (stage, "button-press-event",
diff --git a/tests/performance/test-state-mini.c b/tests/performance/test-state-mini.c
index 9120036..773b9d0 100644
--- a/tests/performance/test-state-mini.c
+++ b/tests/performance/test-state-mini.c
@@ -60,7 +60,6 @@ gint
 main (gint    argc,
       gchar **argv)
 {
-  ClutterColor  black={0,0,0,0xff};
   ClutterActor *stage;
   ClutterState *layout_state;
   gint i;
@@ -69,10 +68,12 @@ main (gint    argc,
   if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
     g_error ("Failed to initialize Clutter");
 
-  stage = clutter_stage_get_default ();
+  stage = clutter_stage_new ();
   layout_state = clutter_state_new ();
-  clutter_stage_set_color (CLUTTER_STAGE (stage), &black);
+  clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [mini]");
+  clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black);
   clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
+  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
 
   for (i=0; i<TOTAL; i++)
     {
diff --git a/tests/performance/test-state-pick.c b/tests/performance/test-state-pick.c
index c5e0ba6..0dc450a 100644
--- a/tests/performance/test-state-pick.c
+++ b/tests/performance/test-state-pick.c
@@ -65,7 +65,6 @@ gint
 main (gint    argc,
       gchar **argv)
 {
-  ClutterColor  black={0,0,0,0xff};
   ClutterActor *stage;
   ClutterState *layout_state;
   gint i;
@@ -74,10 +73,12 @@ main (gint    argc,
   if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
     g_error ("Failed to initialize Clutter");
 
-  stage = clutter_stage_get_default ();
+  stage = clutter_stage_new ();
   layout_state = clutter_state_new ();
-  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), "State Performance [pick]");
   clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
+  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
 
   for (i=0; i<TOTAL; i++)
     {
diff --git a/tests/performance/test-state.c b/tests/performance/test-state.c
index d931a6e..7b0778c 100644
--- a/tests/performance/test-state.c
+++ b/tests/performance/test-state.c
@@ -65,7 +65,6 @@ gint
 main (gint    argc,
       gchar **argv)
 {
-  ClutterColor  black={0,0,0,0xff};
   ClutterActor *stage;
   ClutterState *layout_state;
   gint i;
@@ -74,10 +73,12 @@ main (gint    argc,
   if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv))
     g_error ("Failed to initialize Clutter");
 
-  stage = clutter_stage_get_default ();
+  stage = clutter_stage_new ();
   layout_state = clutter_state_new ();
-  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), "State Performance");
   clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT);
+  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
 
   for (i=0; i<TOTAL; i++)
     {
diff --git a/tests/performance/test-text-perf.c b/tests/performance/test-text-perf.c
index 9f9ae80..93f1bd3 100644
--- a/tests/performance/test-text-perf.c
+++ b/tests/performance/test-text-perf.c
@@ -106,9 +106,11 @@ 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_title (CLUTTER_STAGE (stage), "Text Performance");
+  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
 
   label = create_label ();
   w = clutter_actor_get_width (label);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]