summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-06-23 15:50:36 +0200
committerBenjamin Otte <otte@redhat.com>2010-06-23 16:03:03 +0200
commite4fb4e3411126d269b695bef1f3426ca116ae6ac (patch)
treee903f9fce4a6ac5dff8da1ccb881df17ff79456e
parenteb7b5a9970032f434cbe55eb095e01309fe838b8 (diff)
perf-chart: Add special color for the legend
-rw-r--r--perf/cairo-perf-chart.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/perf/cairo-perf-chart.c b/perf/cairo-perf-chart.c
index 3f9c5a9b..6bcd6e60 100644
--- a/perf/cairo-perf-chart.c
+++ b/perf/cairo-perf-chart.c
@@ -297,7 +297,8 @@ get_report_color (struct chart *chart, int report, struct color * color_out)
}
typedef enum {
- SPECIAL_COLOR_BAR_LABEL
+ SPECIAL_COLOR_BAR_LABEL,
+ SPECIAL_COLOR_LEGEND_LABEL
} special_color_t;
static void
@@ -310,6 +311,12 @@ 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_LEGEND_LABEL:
+ if (using_predefined_colors (chart))
+ SET_COLOR (color_out, 0.5, 0.5, 0.5);
+ else
+ SET_COLOR (color_out, 0.95, 0.95, 0.95);
+ break;
default:
SET_COLOR (color_out, 1, 0, 1);
}
@@ -838,7 +845,8 @@ add_legend (struct chart *chart)
cairo_rectangle (chart->cr, x, y + 6, 8, 8);
cairo_fill (chart->cr);
- cairo_set_source_rgb (chart->cr, 1, 1, 1);
+ get_special_color (chart, SPECIAL_COLOR_LEGEND_LABEL, &color);
+ cairo_set_source_rgb (chart->cr, color.red, color.green, color.blue);
cairo_move_to (chart->cr, x + 10, y + FONT_SIZE + PAD / 2.);
cairo_text_extents (chart->cr, str, &extents);
cairo_show_text (chart->cr, str);
@@ -905,8 +913,10 @@ main (int argc, const char *argv[])
chart.cr = cairo_create (surface);
cairo_surface_destroy (surface);
- cairo_set_source_rgb (chart.cr, 0, 0, 0);
- cairo_paint (chart.cr);
+ if (!using_predefined_colors (&chart)) {
+ cairo_set_source_rgb (chart.cr, 0, 0, 0);
+ cairo_paint (chart.cr);
+ }
find_ranges (&chart);