diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-18 19:16:29 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-18 19:21:02 +0100 |
commit | 1391ae08eb007205ad79d4201c3bf499239f8697 (patch) | |
tree | 1f4960adfe61d7b0fe7e6f39c5afa5c1d964c99d /overlay/chart.c | |
parent | 90ef68859c3e5edf2a6cd6b274f0443b936c9e0d (diff) |
overlay: Don't smooth gpu freq
This is supposed to be discrete jumps, so use straight lines to emphasis
this nature.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay/chart.c')
-rw-r--r-- | overlay/chart.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/overlay/chart.c b/overlay/chart.c index bc0489cd..d72fe758 100644 --- a/overlay/chart.c +++ b/overlay/chart.c @@ -18,6 +18,7 @@ int chart_init(struct chart *chart, const char *name, int num_samples) chart->num_samples = num_samples; chart->range_automatic = 1; chart->stroke_width = 2; + chart->smooth = CHART_CURVE; return 0; } @@ -26,6 +27,11 @@ void chart_set_mode(struct chart *chart, enum chart_mode mode) chart->mode = mode; } +void chart_set_smooth(struct chart *chart, enum chart_smooth smooth) +{ + chart->smooth = smooth; +} + void chart_set_stroke_width(struct chart *chart, float width) { chart->stroke_width = width; @@ -159,10 +165,18 @@ void chart_draw(struct chart *chart, cairo_t *cr) if (chart->mode != CHART_STROKE) cairo_move_to(cr, 0, 0); for (n = 0; n < max; n++) { - cairo_curve_to(cr, - n-2/3., value_at(chart, i + n -1) + gradient_at(chart, i + n - 1)/3., - n-1/3., value_at(chart, i + n) - gradient_at(chart, i + n)/3., - n, value_at(chart, i + n)); + switch (chart->smooth) { + case CHART_LINE: + cairo_line_to(cr, + n, value_at(chart, i + n)); + break; + case CHART_CURVE: + cairo_curve_to(cr, + n-2/3., value_at(chart, i + n -1) + gradient_at(chart, i + n - 1)/3., + n-1/3., value_at(chart, i + n) - gradient_at(chart, i + n)/3., + n, value_at(chart, i + n)); + break; + } } if (chart->mode != CHART_STROKE) cairo_line_to(cr, n-1, 0); |