[test-text-perf] Small fix-ups

- Fix a typo in a for loop in create_label which left 'i'
  uninitialised and caused a crash if you're unlucky.

- Set the CLUTTER_VBLANK=none environment variable.

- Don't quit on a keypress.

- Trailing whitespace tidy up.
This commit is contained in:
Neil Roberts 2009-05-21 17:43:41 +01:00
parent 8724a16452
commit a1b0160da7

View File

@ -13,16 +13,16 @@ static int rows, cols;
gboolean idle (gpointer data)
{
ClutterActor *stage = CLUTTER_ACTOR (data);
static GTimer *timer = NULL;
static int fps = 0;
if (!timer)
{
timer = g_timer_new ();
g_timer_start (timer);
}
if (g_timer_elapsed (timer, NULL) >= 1)
{
printf ("fps=%d, strings/sec=%d, chars/sec=%d\n",
@ -32,7 +32,7 @@ gboolean idle (gpointer data)
g_timer_start (timer);
fps = 0;
}
clutter_actor_paint (stage);
++fps;
@ -40,7 +40,7 @@ gboolean idle (gpointer data)
}
static ClutterActor *
create_label()
create_label ()
{
ClutterColor label_color = { 0xff, 0xff, 0xff, 0xff };
ClutterActor *label;
@ -51,7 +51,7 @@ create_label()
font_name = g_strdup_printf ("Monospace %dpx", font_size);
str = g_string_new (NULL);
for (i < 0; i < n_chars; i++)
for (i = 0; i < n_chars; i++)
g_string_append_c (str, 'A' + (i % 26));
label = clutter_text_new_with_text (font_name, str->str);
@ -72,6 +72,8 @@ main (int argc, char *argv[])
int w, h;
int row, col;
g_setenv ("CLUTTER_VBLANK", "none", FALSE);
clutter_init (&argc, &argv);
if (argc != 3)
@ -112,12 +114,9 @@ main (int argc, char *argv[])
clutter_actor_show_all (stage);
g_signal_connect (stage, "key-press-event",
G_CALLBACK (clutter_main_quit), NULL);
g_idle_add (idle, (gpointer) stage);
clutter_main();
clutter_main ();
return 0;
}