remove unnecessary calls to get process pixels, but rare case
[lttv.git] / ltt / branches / poly / lttv / modules / gui / controlflow / drawing.c
index 3a15130c9cccd404cc27e579bb52e41a57605659..265c68d5563d8461c1f10946523a75d683e8aaf2 100644 (file)
@@ -138,15 +138,11 @@ void drawing_data_request(Drawing_t *drawing,
   g_debug("x is : %i, x+width is : %i", x, x+width);
 
   convert_pixels_to_time(drawing->width, x,
-        time_window.start_time,
-        time_window.time_width,
-        window_end,
+        time_window,
         &start);
 
   convert_pixels_to_time(drawing->width, x+width,
-        time_window.start_time,
-        time_window.time_width,
-        window_end,
+        time_window,
         &time_end);
 
   lttvwindow_events_request_remove_all(tab,
@@ -387,6 +383,7 @@ static void set_last_start(gpointer key, gpointer value, gpointer user_data)
   hashed_process_data->x.under = x;
   hashed_process_data->x.under_used = FALSE;
   hashed_process_data->x.under_marked = FALSE;
+  hashed_process_data->next_good_time = ltt_time_zero;
 
   return;
 }
@@ -406,15 +403,17 @@ void drawing_data_request_begin(EventsRequest *events_request, LttvTracesetState
   cfd->drawing->last_start = events_request->start_time;
 
   convert_time_to_pixels(
-          time_window.start_time,
-          time_window.time_width,
-          end_time,
+          time_window,
           events_request->start_time,
           width,
           &x);
 
   g_hash_table_foreach(cfd->process_list->process_hash, set_last_start,
                             (gpointer)x);
+
+  cfd->process_list->current_process_info = NULL;
+  cfd->process_list->current_hash_data = NULL;
+
 }
 
 void drawing_chunk_begin(EventsRequest *events_request, LttvTracesetState *tss)
@@ -448,18 +447,14 @@ void drawing_request_expose(EventsRequest *events_request,
 
 #if 0
   convert_time_to_pixels(
-        time_window.start_time,
-        time_window.time_width,
-        window_end,
+        time_window,
         cfd->drawing->last_start,
         drawing->width,
         &x);
 
 #endif //0
   convert_time_to_pixels(
-        time_window.start_time,
-        time_window.time_width,
-        window_end,
+        time_window,
         end_time,
         drawing->width,
         &x_end);
@@ -614,9 +609,7 @@ expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer user_data )
   {
     /* Draw the dotted lines */
     convert_time_to_pixels(
-          time_window.start_time,
-          time_window.time_width,
-          window_end,
+          time_window,
           current_time,
           drawing->width,
           &cursor_x);
@@ -704,9 +697,7 @@ button_press_event( GtkWidget *widget, GdkEventButton *event, gpointer user_data
     g_debug("x click is : %f", event->x);
 
     convert_pixels_to_time(drawing->width, (guint)event->x,
-        time_window.start_time,
-        time_window.time_width,
-        window_end,
+        time_window,
         &time);
 
     lttvwindow_report_current_time(control_flow_data->tab, time);
@@ -933,44 +924,39 @@ GtkWidget *drawing_get_widget(Drawing_t *drawing)
 __inline void convert_pixels_to_time(
     gint width,
     guint x,
-    LttTime window_time_begin,
-    LttTime window_time_interval,
-    LttTime window_time_end,
+    TimeWindow time_window,
     LttTime *time)
 {
   double time_d;
   
-  time_d = ltt_time_to_double(window_time_interval);
+  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(window_time_begin, *time);
+  *time = ltt_time_add(time_window.start_time, *time);
 }
 
 
 __inline void convert_time_to_pixels(
-    LttTime window_time_begin,
-    LttTime window_time_interval,
-    LttTime window_time_end,
+    TimeWindow time_window,
     LttTime time,
     int width,
     guint *x)
 {
-  double time_d, interval_d;
+  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, window_time_begin);
+  time = ltt_time_sub(time, time_window.start_time);
   
   time_d = ltt_time_to_double(time);
-  interval_d = ltt_time_to_double(window_time_interval);
   
-  if(interval_d == 0.0) {
+  if(time_window.time_width_double == 0.0) {
     g_assert(time_d == 0.0);
     *x = 0;
   } else {
-    *x = (guint)(time_d / interval_d * (double)width);
+    *x = (guint)(time_d / time_window.time_width_double * (double)width);
   }
   
 }
This page took 0.02377 seconds and 4 git commands to generate.