visualizers: use double instead of float

To give us less changes of incorrect values when converting between scales
(at the cost of 2x the array size).
This commit is contained in:
Christian Hergert
2018-06-16 20:22:53 -07:00
parent c9c86ff37a
commit 50ccd73592
4 changed files with 15 additions and 15 deletions

View File

@ -80,8 +80,8 @@ point_cache_contains_set (PointCache *self,
void void
point_cache_add_point_to_set (PointCache *self, point_cache_add_point_to_set (PointCache *self,
guint set_id, guint set_id,
gfloat x, gdouble x,
gfloat y) gdouble y)
{ {
GArray *ar; GArray *ar;
Point point = { x, y }; Point point = { x, y };

View File

@ -27,8 +27,8 @@ typedef struct _PointCache PointCache;
typedef struct typedef struct
{ {
gfloat x; gdouble x;
gfloat y; gdouble y;
} Point; } Point;
PointCache *point_cache_new (void); PointCache *point_cache_new (void);
@ -40,8 +40,8 @@ gboolean point_cache_contains_set (PointCache *self,
guint set_id); guint set_id);
void point_cache_add_point_to_set (PointCache *self, void point_cache_add_point_to_set (PointCache *self,
guint set_id, guint set_id,
gfloat x, gdouble x,
gfloat y); gdouble y);
const Point *point_cache_get_points (PointCache *self, const Point *point_cache_get_points (PointCache *self,
guint set_id, guint set_id,
guint *n_points); guint *n_points);

View File

@ -170,8 +170,8 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
if (n_fpoints > 0) if (n_fpoints > 0)
{ {
gfloat last_x; gdouble last_x;
gfloat last_y; gdouble last_y;
points = g_new0 (SpVisualizerRowAbsolutePoint, n_fpoints); points = g_new0 (SpVisualizerRowAbsolutePoint, n_fpoints);
@ -534,7 +534,7 @@ counter_type (LoadData *load,
return SP_CAPTURE_COUNTER_DOUBLE; return SP_CAPTURE_COUNTER_DOUBLE;
} }
static inline gfloat static inline gdouble
calc_x (gint64 lower, calc_x (gint64 lower,
gint64 upper, gint64 upper,
gint64 value) gint64 value)
@ -542,7 +542,7 @@ calc_x (gint64 lower,
return (gdouble)(value - lower) / (gdouble)(upper - lower); return (gdouble)(value - lower) / (gdouble)(upper - lower);
} }
static inline gfloat static inline gdouble
calc_y_double (gdouble lower, calc_y_double (gdouble lower,
gdouble upper, gdouble upper,
gdouble value) gdouble value)
@ -550,7 +550,7 @@ calc_y_double (gdouble lower,
return (value - lower) / (upper - lower); return (value - lower) / (upper - lower);
} }
static inline gfloat static inline gdouble
calc_y_int64 (gint64 lower, calc_y_int64 (gint64 lower,
gint64 upper, gint64 upper,
gint64 value) gint64 value)
@ -572,7 +572,7 @@ sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
if (frame->type == SP_CAPTURE_FRAME_CTRSET) if (frame->type == SP_CAPTURE_FRAME_CTRSET)
{ {
const SpCaptureFrameCounterSet *set = (SpCaptureFrameCounterSet *)frame; const SpCaptureFrameCounterSet *set = (SpCaptureFrameCounterSet *)frame;
gfloat x = calc_x (load->begin_time, load->end_time, frame->time); gdouble x = calc_x (load->begin_time, load->end_time, frame->time);
for (guint i = 0; i < set->n_values; i++) for (guint i = 0; i < set->n_values; i++)
{ {
@ -584,7 +584,7 @@ sp_line_visualizer_row_load_data_frame_cb (const SpCaptureFrame *frame,
if (counter_id != 0 && contains_id (load->lines, counter_id)) if (counter_id != 0 && contains_id (load->lines, counter_id))
{ {
gfloat y; gdouble y;
if (counter_type (load, counter_id) == SP_CAPTURE_COUNTER_DOUBLE) if (counter_type (load, counter_id) == SP_CAPTURE_COUNTER_DOUBLE)
y = calc_y_double (load->y_lower, load->y_upper, group->values[j].vdbl); y = calc_y_double (load->y_lower, load->y_upper, group->values[j].vdbl);

View File

@ -32,8 +32,8 @@ G_DECLARE_DERIVABLE_TYPE (SpVisualizerRow, sp_visualizer_row, SP, VISUALIZER_ROW
typedef struct typedef struct
{ {
gfloat x; gdouble x;
gfloat y; gdouble y;
} SpVisualizerRowRelativePoint; } SpVisualizerRowRelativePoint;
typedef struct typedef struct