tests.c
-----------------------------------------------------------------------------------------------------------------
:{ /* on_idle_gtkdrawingarea_lines_test total:
535 64.3803 */
:
: AppData *appdata = NULL;
: appdata = (AppData *) data;
:
: int i = 0;
:
:
/* create graphical context */
1 0.1203 : appdata->graphical_context =
: gdk_gc_new (appdata->drawingarea_drawing->window);
:
: /* drawing lines is so fast that we'll make 1000 in one loop */
: /* just remember to show this in results! */
331 39.8315 : for (i = 0; i < 1000; i++)
:
{
:
7 0.8424 : set_random_drawing_color ();
:
: gint x1 = g_random_int_range (0,
: appdata->drawingarea_drawing->
111 13.3574
: allocation.width);
:
gint x2 = g_random_int_range (0,
: appdata->drawingarea_drawing->
11 1.3237 : allocation.width
);
: gint y1 = g_random_int_range (0,
:
appdata->drawingarea_drawing->
30 3.6101 :
allocation.height);
: gint y2 = g_random_int_range (0,
: appdata->drawingarea_drawing->
17 2.0457 : allocation.height);
:
27 3.2491 : gdk_draw_line (appdata->drawingarea_drawing->window,
: appdata->graphical_context, x1, y1, x2, y2);
: }
:void
:set_random_drawing_color ()
10 1.2034 :{ /* set_random_drawing_color total: 188 22.6233 */
:
115 13.8387 : appdata->current_color.red = g_random_int_range (1, 65535);
12 1.4440 : appdata->current_color.green = g_random_int_range (1, 65535);
10
1.2034 : appdata->current_color.blue = g_random_int_range (1, 65535);
:
18 2.1661 : gdk_colormap_alloc_color (gdk_colormap_get_system (),
:
&appdata->current_color, FALSE, TRUE);
7 0.8424 :
gdk_gc_set_foreground (appdata->graphical_context,
: &appdata->current_color);
16 1.9254 :}
:
:void
:on_button_clear_clicked (GtkButton * button, gpointer user_data)
:{
: gtk_text_buffer_set_text (appdata->textview_info_buffer, "", 0);
:}