diff options
author | Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> | 2021-10-14 18:59:13 +0300 |
---|---|---|
committer | Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> | 2021-10-18 12:21:35 +0300 |
commit | ea0624871db6c57c6bca964c60643c6da483c253 (patch) | |
tree | fb7bfbabb2be1df0429591fdd31280ff09c6aed8 /tests/kms_cursor_crc.c | |
parent | 5f1b44b37ad514fd55db978a92e2e2b673a8256e (diff) |
tests/kms_cursor_crc: take alpha into use when draw cursor
Draw with alpha information included.
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'tests/kms_cursor_crc.c')
-rw-r--r-- | tests/kms_cursor_crc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index 0648a860..5d0fc513 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -72,6 +72,7 @@ typedef struct { cairo_surface_t *surface; uint32_t devid; bool hwimageistestimage; + double alpha; } data_t; #define TEST_DPMS (1<<0) @@ -89,7 +90,7 @@ typedef struct { int height; } cursorarea; -static void draw_cursor(cairo_t *cr, cursorarea *cursor) +static void draw_cursor(cairo_t *cr, cursorarea *cursor, double alpha) { int wl, wr, ht, hb; @@ -104,13 +105,13 @@ static void draw_cursor(cairo_t *cr, cursorarea *cursor) (cursor->y < SHRT_MIN) || (cursor->y > SHRT_MAX)) return; - cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE); /* 4 color rectangles in the corners, RGBY */ - igt_paint_color(cr, cursor->x, cursor->y, wl, ht, RED); - igt_paint_color(cr, cursor->x + wl, cursor->y, wr, ht, GREEN); - igt_paint_color(cr, cursor->x, cursor->y + ht, wl, hb, BLUE); - igt_paint_color(cr, cursor->x + wl, cursor->y + ht, wr, hb, WHITE); + igt_paint_color_alpha(cr, cursor->x, cursor->y, wl, ht, RED, alpha); + igt_paint_color_alpha(cr, cursor->x + wl, cursor->y, wr, ht, GREEN, alpha); + igt_paint_color_alpha(cr, cursor->x, cursor->y + ht, wl, hb, BLUE, alpha); + igt_paint_color_alpha(cr, cursor->x + wl, cursor->y + ht, wr, hb, WHITE, alpha); } static void cursor_enable(data_t *data) @@ -173,7 +174,7 @@ static void restore_image(data_t *data, uint32_t buffer, cursorarea *cursor) cairo_fill(cr); if (cursor) - draw_cursor(cr, cursor); + draw_cursor(cr, cursor, data->alpha); igt_put_cairo_ctx(cr); } @@ -549,7 +550,7 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h) cr = igt_get_cairo_ctx(data->drm_fd, &data->fb); cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); igt_paint_color_alpha(cr, 0, 0, cur_w, cur_h, 0.0, 0.0, 0.0, 0.0); - draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h})); + draw_cursor(cr, &((cursorarea){0, 0, cur_w, cur_h}), data->alpha); igt_put_cairo_ctx(cr); } @@ -828,6 +829,7 @@ static void run_tests_on_pipe(data_t *data, enum pipe pipe) data->output = igt_get_single_output_for_pipe(&data->display, pipe); igt_require(data->output); data->hwimageistestimage = false; + data->alpha = 1.0; } igt_describe("Create a maximum size cursor, then change the size in " |