@@ -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);
}
@@ -102,6 +102,7 @@ typedef struct {
cairo_t *cr;
/* plot-wide states */
+ int debug;
unsigned int width, height;
char *title;
igt_trbl_t margin;
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- lib/igt_plot.c | 16 +++++++++++++++- lib/igt_plot.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)