lib/igt_fb: setup font in igt_get_cairo_ctx

We always want the same boring one, so extract it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2014-03-26 16:36:46 +01:00
parent ae461e67e8
commit 7568edf4b1
4 changed files with 3 additions and 7 deletions

View File

@ -382,7 +382,10 @@ cairo_t *igt_get_cairo_ctx(int fd, struct igt_fb *fb)
surface = get_cairo_surface(fd, fb);
cr = cairo_create(surface);
cairo_surface_destroy(surface);
igt_assert(cairo_status(cr) == CAIRO_STATUS_SUCCESS);
cairo_select_font_face(cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
igt_assert(cairo_status(cr) == CAIRO_STATUS_SUCCESS);
return cr;

View File

@ -60,8 +60,6 @@ static int paint_fb(struct igt_fb *fb, const char *test_name,
igt_paint_color_gradient(cr, 0, 0, fb->width, fb->height, 1, 1, 1);
igt_paint_test_pattern(cr, fb->width, fb->height);
cairo_select_font_face(cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_move_to(cr, fb->width / 2, fb->height / 2);
cairo_set_font_size(cr, 36);
igt_cairo_printf_line(cr, align_hcenter, 10, "%s", test_name);

View File

@ -152,8 +152,6 @@ static int paint_fb(struct igt_fb *fb, const char *test_name,
igt_paint_test_pattern(cr, fb->width, fb->height);
cairo_select_font_face(cr, "Helvetica", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_move_to(cr, fb->width / 2, fb->height / 2);
cairo_set_font_size(cr, 24);
igt_cairo_printf_line(cr, align_hcenter, 40, "%s", test_name);

View File

@ -284,9 +284,6 @@ static void paint_output_info(struct connector *c, struct igt_fb *fb)
igt_paint_test_pattern(cr, l_width, l_height);
cairo_select_font_face(cr, "Helvetica",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_move_to(cr, l_width / 2, l_height / 2);
/* Print connector and mode name */