X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fcontrolflow%2Fdrawing.h;h=ce058111846e9ed9d9edc0a5f15b76dee3150955;hb=04cd9a1e94f33a731da0871ab6c4edb3db37cc4d;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..ce058111 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]; @@ -134,20 +134,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 +152,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