[Intel-gfx] [PATCH i-g-t 10/16] plot: Make sure to have a color in the background
Damien Lespiau
damien.lespiau at intel.com
Mon Jul 6 05:35:38 PDT 2015
Until now we had transparent black.
Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
lib/igt_plot.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/lib/igt_plot.c b/lib/igt_plot.c
index c8d6dcb..afe4a1c 100644
--- a/lib/igt_plot.c
+++ b/lib/igt_plot.c
@@ -452,6 +452,24 @@ igt_plot_draw_text(igt_plot_t *plot, double x, double y, igt_label_t *label)
cairo_show_text(plot->cr, label->text);
}
+static void igt_plot_draw_background(igt_plot_t *plot, flush_t *flush)
+{
+ igt_box_t *area = &flush->plot_area;
+ double area_width, area_height;
+
+ area_width = area->x2 - area->x1;
+ area_height = area->y2 - area->y1;
+
+ cairo_set_source_rgb(plot->cr, 1.0, 1.0, 1.0);
+ cairo_rectangle(plot->cr, 0.0, 0.0, plot->width, plot->height);
+ cairo_fill(plot->cr);
+
+ cairo_set_source_rgb(plot->cr, 0.99, 0.99, 0.99);
+ cairo_rectangle(plot->cr, SNAP(area->x1), SNAP(area->y1),
+ area_width, area_height);
+ cairo_fill(plot->cr);
+}
+
static void igt_plot_draw_grid(igt_plot_t *plot, flush_t *flush)
{
unsigned int i, n_ticks;
@@ -701,8 +719,8 @@ void igt_plot_write(igt_plot_t *plot, const char *filename)
igt_plot_layout(plot, &flush);
+ igt_plot_draw_background(plot, &flush);
igt_plot_draw_axis(plot, &flush);
-
for (i = 0; i < plot->n_valid_contexts; i++)
igt_plot_draw_one(plot, &plot->contexts[i], &flush);
--
2.1.0
More information about the Intel-gfx
mailing list