summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-06-23 16:26:46 +0200
committerBenjamin Otte <otte@redhat.com>2010-06-23 16:26:46 +0200
commit8ca7870acd7c5b93e1bb569c55f36f1064f533e1 (patch)
treecdfa7151a3154f9b1fad8f393a707a78182896f5
parente4fb4e3411126d269b695bef1f3426ca116ae6ac (diff)
perf-chart: Add special colors for base axis
-rw-r--r--perf/cairo-perf-chart.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/perf/cairo-perf-chart.c b/perf/cairo-perf-chart.c
index 6bcd6e60..1c09cd87 100644
--- a/perf/cairo-perf-chart.c
+++ b/perf/cairo-perf-chart.c
@@ -298,7 +298,9 @@ get_report_color (struct chart *chart, int report, struct color * color_out)
typedef enum {
SPECIAL_COLOR_BAR_LABEL,
- SPECIAL_COLOR_LEGEND_LABEL
+ SPECIAL_COLOR_LEGEND_LABEL,
+ SPECIAL_COLOR_BASE_ABSOLUTE,
+ SPECIAL_COLOR_BASE_RELATIVE,
} special_color_t;
static void
@@ -317,6 +319,18 @@ get_special_color (struct chart *chart, special_color_t special, struct color *
else
SET_COLOR (color_out, 0.95, 0.95, 0.95);
break;
+ case SPECIAL_COLOR_BASE_ABSOLUTE:
+ if (using_predefined_colors (chart))
+ SET_COLOR (color_out, 0.5, 0.5, 0.5);
+ else
+ SET_COLOR (color_out, 1, 1, 1);
+ break;
+ case SPECIAL_COLOR_BASE_RELATIVE:
+ if (using_predefined_colors (chart))
+ *color_out = predefined_colors[0];
+ else
+ SET_COLOR (color_out, 1, 1, 1);
+ break;
default:
SET_COLOR (color_out, 1, 0, 1);
}
@@ -469,17 +483,20 @@ static void
add_base_line (struct chart *c)
{
double y;
+ struct color color;
cairo_save (c->cr);
cairo_set_line_width (c->cr, 2.);
if (c->relative) {
y = c->height / 2.;
+ get_special_color (c, SPECIAL_COLOR_BASE_RELATIVE, &color);
} else {
y = c->height;
+ get_special_color (c, SPECIAL_COLOR_BASE_ABSOLUTE, &color);
}
cairo_move_to (c->cr, 0, y);
cairo_line_to (c->cr, c->width, y);
- cairo_set_source_rgb (c->cr, 1, 1, 1);
+ cairo_set_source_rgb (c->cr, color.red, color.green, color.blue);
cairo_stroke (c->cr);
cairo_restore (c->cr);
}