[Intel-gfx] [PATCH i-g-t 12/16] plot: Add a way to draw debug hints to help layouting
Damien Lespiau
damien.lespiau at intel.com
Mon Jul 6 05:35:40 PDT 2015
Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
lib/igt_plot.c | 16 +++++++++++++++-
lib/igt_plot.h | 1 +
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/lib/igt_plot.c b/lib/igt_plot.c
index 2ca005e..763c000 100644
--- a/lib/igt_plot.c
+++ b/lib/igt_plot.c
@@ -443,7 +443,12 @@ static double plot_length(igt_plot_t *plot, double percent)
static void
igt_plot_draw_text(igt_plot_t *plot, double x, double y, igt_label_t *label)
{
- /* XXX: bearings? */
+ if (plot->debug) {
+ cairo_set_source_rgb(plot->cr, 1.0, 0.0, 0.0);
+ cairo_move_to(plot->cr, x, y);
+ cairo_arc(plot->cr, x, y, 2.0, 0, 2 * M_PI);
+ cairo_fill(plot->cr);
+ }
switch (label->halign) {
case IGT_ALIGN_LEFT:
@@ -469,6 +474,15 @@ igt_plot_draw_text(igt_plot_t *plot, double x, double y, igt_label_t *label)
break;
}
+ if (plot->debug) {
+ cairo_set_source_rgb(plot->cr, 1.0, 0.0, 0.0);
+ cairo_move_to(plot->cr, x, y);
+ cairo_rectangle(plot->cr, x, y,
+ label->extents.width, -label->extents.height);
+ cairo_stroke(plot->cr);
+ }
+
+ cairo_set_source_rgb(plot->cr, 0.0, 0.0, 0.0);
cairo_move_to(plot->cr, x, y);
cairo_show_text(plot->cr, label->text);
}
diff --git a/lib/igt_plot.h b/lib/igt_plot.h
index cca498a..49d5819 100644
--- a/lib/igt_plot.h
+++ b/lib/igt_plot.h
@@ -102,6 +102,7 @@ typedef struct {
cairo_t *cr;
/* plot-wide states */
+ int debug;
unsigned int width, height;
char *title;
igt_trbl_t margin;
--
2.1.0
More information about the Intel-gfx
mailing list