X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Fdrawing.h;h=3cf84ab838ff4e8a92958849a8c3d8d751202fc4;hb=f4b88a7dd49bfb6b88ea579410d7e4b59faaf73c;hp=bac0b6b8ad7a860b128997b2e3bbcdc04ae701d0;hpb=90ef7e4a2c6a41ec36bd2530b187cc1ef2cf0025;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h index bac0b6b8..3cf84ab8 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.h @@ -33,21 +33,21 @@ #define SAFETY 50 // safety pixels at right and bottom of pixmap buffer - -typedef enum _draw_color { COL_BLACK, - COL_WHITE, - COL_WAIT_FORK, - COL_WAIT_CPU, - COL_EXIT, - COL_ZOMBIE, - COL_WAIT, - COL_RUN, - COL_USER_MODE, - COL_SYSCALL, - COL_TRAP, - COL_IRQ, - COL_MODE_UNKNOWN, - NUM_COLORS } draw_color; +typedef enum _draw_color { + COL_BLACK, + COL_WHITE, + COL_RUN_USER_MODE,/* green */ + COL_RUN_SYSCALL, /* pale blue */ + COL_RUN_TRAP, /* yellow */ + COL_RUN_IRQ, /* red */ + COL_WAIT, /* dark red */ + COL_WAIT_CPU, /* dark yellow */ + COL_ZOMBIE, /* dark purple */ + COL_WAIT_FORK, /* dark green */ + COL_EXIT, /* "less dark" magenta */ + COL_MODE_UNKNOWN, /* white */ + COL_UNNAMED, /* white */ + NUM_COLORS } draw_color; extern GdkColor drawing_colors[NUM_COLORS]; @@ -73,7 +73,15 @@ extern GdkColor drawing_colors[NUM_COLORS]; * of the shown processes. */ +#ifndef TYPE_DRAWING_T_DEFINED +#define TYPE_DRAWING_T_DEFINED typedef struct _Drawing_t Drawing_t; +#endif //TYPE_DRAWING_T_DEFINED + +#ifndef TYPE_CONTROLFLOWDATA_DEFINED +#define TYPE_CONTROLFLOWDATA_DEFINED +typedef struct _ControlFlowData ControlFlowData; +#endif //TYPE_CONTROLFLOWDATA_DEFINED struct _Drawing_t { GtkWidget *vbox; @@ -86,12 +94,14 @@ struct _Drawing_t { GtkWidget *ruler_hbox; GtkWidget *ruler; GtkWidget *padding; - GdkPixmap *pixmap; + //GdkPixmap *pixmap; ControlFlowData *control_flow_data; PangoLayout *pango_layout; gint height, width, depth; + /* height and width of allocated buffer pixmap */ + gint alloc_height, alloc_width; /* X coordinate of damaged region */ gint damage_begin, damage_end; /* damaged region to be exposed, @@ -110,6 +120,12 @@ void drawing_destroy(Drawing_t *drawing); GtkWidget *drawing_get_widget(Drawing_t *drawing); GtkWidget *drawing_get_drawing_area(Drawing_t *drawing); + +void drawing_data_request(Drawing_t *drawing, + gint x, gint y, + gint width, + gint height); + void drawing_draw_line( Drawing_t *drawing, GdkPixmap *pixmap, guint x1, guint y1, @@ -134,20 +150,6 @@ void drawing_remove_square(Drawing_t *drawing, guint y, guint height); -__inline void convert_pixels_to_time( - gint width, - guint x, - LttTime window_time_begin, - LttTime window_time_end, - LttTime *time); - -__inline void convert_time_to_pixels( - LttTime window_time_begin, - LttTime window_time_end, - LttTime time, - gint width, - guint *x); - void drawing_update_ruler(Drawing_t *drawing, TimeWindow *time_window); void drawing_request_expose(EventsRequest *events_request, @@ -166,4 +168,51 @@ tree_row_activated(GtkTreeModel *treemodel, GtkTreeViewColumn *arg2, gpointer user_data); + +/* convert_pixels_to_time + * + * Convert from window pixel and time interval to an absolute time. + */ +static inline void convert_pixels_to_time( + gint width, + guint x, + TimeWindow time_window, + LttTime *time) +{ + double time_d; + + time_d = time_window.time_width_double; + time_d = time_d / (double)width * (double)x; + *time = ltt_time_from_double(time_d); + *time = ltt_time_add(time_window.start_time, *time); +} + + +static inline void convert_time_to_pixels( + TimeWindow time_window, + LttTime time, + int width, + guint *x) +{ + double time_d; +#ifdef EXTRA_CHECK + g_assert(ltt_time_compare(window_time_begin, time) <= 0 && + ltt_time_compare(window_time_end, time) >= 0); +#endif //EXTRA_CHECK + + time = ltt_time_sub(time, time_window.start_time); + + time_d = ltt_time_to_double(time); + + if(time_window.time_width_double == 0.0) { + g_assert(time_d == 0.0); + *x = 0; + } else { + *x = (guint)(time_d / time_window.time_width_double * (double)width); + } + +} + + + #endif // _DRAWING_H