projects
/
psensor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d6b8f5e
)
performance
author
Jean-Philippe Orsini
<jeanfi@gmail.com>
Tue, 27 Mar 2012 10:36:37 +0000
(10:36 +0000)
committer
Jean-Philippe Orsini
<jeanfi@gmail.com>
Tue, 27 Mar 2012 10:36:37 +0000
(10:36 +0000)
src/graph.c
patch
|
blob
|
history
diff --git
a/src/graph.c
b/src/graph.c
index
c3f4d5c
..
de23bb8
100644
(file)
--- a/
src/graph.c
+++ b/
src/graph.c
@@
-171,7
+171,7
@@
static void draw_sensor_curve(struct psensor *s,
int g_xoff,
int g_yoff)
{
int g_xoff,
int g_yoff)
{
- int first, i, x, y, t;
+ int first, i, x, y, t
, dt, vdt
;
double v;
cairo_set_source_rgb(cr,
double v;
cairo_set_source_rgb(cr,
@@
-179,15
+179,20
@@
static void draw_sensor_curve(struct psensor *s,
s->color->f_green,
s->color->f_blue);
s->color->f_green,
s->color->f_blue);
+ dt = et - bt;
first = 1;
for (i = 0; i < s->values_max_length; i++) {
t = s->measures[i].time.tv_sec;
v = s->measures[i].value.d_num;
first = 1;
for (i = 0; i < s->values_max_length; i++) {
t = s->measures[i].time.tv_sec;
v = s->measures[i].value.d_num;
- if (v == UNKNOWN_DBL_VALUE || !t
|| (t - bt) < 0
)
+ if (v == UNKNOWN_DBL_VALUE || !t)
continue;
continue;
- x = (t - bt) * g_width / (et - bt) + g_xoff;
+ vdt = t - bt;
+ if (vdt < 0)
+ continue;
+
+ x = vdt * g_width / dt + g_xoff;
y = compute_y(v, min, max, g_height, g_yoff);
y = compute_y(v, min, max, g_height, g_yoff);