summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-07-12 18:11:21 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-07-12 18:14:59 +0100
commit70c2125e2c968358a8c7ddaa4e356e9b0de9c323 (patch)
treeae05a28277a153c1d34ccb86489d9f08794521ed /perf
parent6aed048484801285ca7bd5afd825294f1ab7ce6d (diff)
perf/chart: Render a solid bar if the column is too narrow for the gradient
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'perf')
-rw-r--r--perf/cairo-perf-chart.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/perf/cairo-perf-chart.c b/perf/cairo-perf-chart.c
index df0bd88da..a993ce8a9 100644
--- a/perf/cairo-perf-chart.c
+++ b/perf/cairo-perf-chart.c
@@ -359,21 +359,26 @@ add_chart (struct chart *c,
dx = c->width / (double) (c->num_tests * c->num_reports);
x = dx * (c->num_reports * test + report - .5);
- set_report_gradient (c, report,
- floor (x), c->height / 2.,
- floor (x + dx) - floor (x),
- ceil (-dy*value - c->height/2.) + c->height/2.);
-
cairo_rectangle (c->cr,
floor (x), c->height / 2.,
floor (x + dx) - floor (x),
ceil (-dy*value - c->height/2.) + c->height/2.);
- cairo_fill_preserve (c->cr);
- cairo_save (c->cr);
- cairo_clip_preserve (c->cr);
- set_report_color (c, report);
- cairo_stroke (c->cr);
- cairo_restore (c->cr);
+ if (dx < 5) {
+ set_report_color (c, report);
+ cairo_fill (c->cr);
+ } else {
+ set_report_gradient (c, report,
+ floor (x), c->height / 2.,
+ floor (x + dx) - floor (x),
+ ceil (-dy*value - c->height/2.) + c->height/2.);
+
+ cairo_fill_preserve (c->cr);
+ cairo_save (c->cr);
+ cairo_clip_preserve (c->cr);
+ set_report_color (c, report);
+ cairo_stroke (c->cr);
+ cairo_restore (c->cr);
+ }
/* Skip the label if the difference between the two is less than 0.1% */
if (fabs (value) < 0.1)
@@ -423,21 +428,25 @@ add_chart (struct chart *c,
dx = c->width / (double) (c->num_tests * (c->num_reports+1));
x = dx * ((c->num_reports+1) * test + report + .5);
- set_report_gradient (c, report,
- floor (x), c->height,
- floor (x + dx) - floor (x),
- floor (c->height - dy*value) - c->height);
-
cairo_rectangle (c->cr,
floor (x), c->height,
floor (x + dx) - floor (x),
floor (c->height - dy*value) - c->height);
- cairo_fill_preserve (c->cr);
- cairo_save (c->cr);
- cairo_clip_preserve (c->cr);
- set_report_color (c, report);
- cairo_stroke (c->cr);
- cairo_restore (c->cr);
+ if (dx < 5) {
+ set_report_color (c, report);
+ cairo_fill (c->cr);
+ } else {
+ set_report_gradient (c, report,
+ floor (x), c->height,
+ floor (x + dx) - floor (x),
+ floor (c->height - dy*value) - c->height);
+ cairo_fill_preserve (c->cr);
+ cairo_save (c->cr);
+ cairo_clip_preserve (c->cr);
+ set_report_color (c, report);
+ cairo_stroke (c->cr);
+ cairo_restore (c->cr);
+ }
}
}