[Intel-gfx] [PATCH 11/12] lib/igt_fb: setup font in igt_get_cairo_ctx

Daniel Vetter daniel.vetter at ffwll.ch
Wed Mar 26 17:15:54 CET 2014


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

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 lib/igt_fb.c        | 3 +++
 tests/kms_render.c  | 2 --
 tests/kms_setmode.c | 2 --
 tests/testdisplay.c | 3 ---
 4 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 4289b50ceac6..60b582fbd012 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -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;
diff --git a/tests/kms_render.c b/tests/kms_render.c
index d39281474ec4..c4a6abb8a760 100644
--- a/tests/kms_render.c
+++ b/tests/kms_render.c
@@ -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);
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 802876a6d728..270d1a3a4223 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -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);
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index c320a9c1e18b..2b0233ea1c8d 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -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 */
-- 
1.8.5.2




More information about the Intel-gfx mailing list