[igt-dev] [PATCH i-g-t] tests/kms_cursor: use safe values for test image to avoid rounding errors

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Fri Nov 8 14:24:42 UTC 2019


instead of 0.5 use 1.0 for white color, this is due to bit replication
effect. Also set cairo to use same blending mode as what HW uses.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 tests/kms_cursor_crc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index d0fb8f1..0125122 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -78,12 +78,13 @@ static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch, double a)
 	/* Cairo doesn't like to be fed numbers that are too wild */
 	if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y > SHRT_MAX))
 		return;
+	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
 	cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
 	/* 4 color rectangles in the corners, RGBY */
 	igt_paint_color_alpha(cr, x,      y,      wl, ht, 1.0, 0.0, 0.0, a);
 	igt_paint_color_alpha(cr, x + wl, y,      wr, ht, 0.0, 1.0, 0.0, a);
 	igt_paint_color_alpha(cr, x,      y + ht, wl, hb, 0.0, 0.0, 1.0, a);
-	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, a);
+	igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 1.0, 1.0, 1.0, a);
 }
 
 static void cursor_enable(data_t *data)
-- 
2.7.4



More information about the igt-dev mailing list