diff options
author | Simon Ser <contact@emersion.fr> | 2023-11-22 01:06:04 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2023-11-22 11:30:14 +0100 |
commit | 0c83c331cab0ba42227473f673a6ef33fc44f854 (patch) | |
tree | 227129e6249c0e12025d66195f14aace0e97a9e8 | |
parent | 40633ae7fda70b8261e0c8d689795bf0dfb40e57 (diff) |
output/cursor: drop legacy rendering API
-rw-r--r-- | types/output/cursor.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/types/output/cursor.c b/types/output/cursor.c index ad37a048..278b0d8a 100644 --- a/types/output/cursor.c +++ b/types/output/cursor.c @@ -56,27 +56,6 @@ void wlr_output_lock_software_cursors(struct wlr_output *output, bool lock) { // again. } -static void output_scissor(struct wlr_output *output, pixman_box32_t *rect) { - struct wlr_renderer *renderer = output->renderer; - assert(renderer); - - struct wlr_box box = { - .x = rect->x1, - .y = rect->y1, - .width = rect->x2 - rect->x1, - .height = rect->y2 - rect->y1, - }; - - int ow, oh; - wlr_output_transformed_resolution(output, &ow, &oh); - - enum wl_output_transform transform = - wlr_output_transform_invert(output->transform); - wlr_box_transform(&box, &box, transform, ow, oh); - - wlr_renderer_scissor(renderer, &box); -} - /** * Returns the cursor box, scaled for its output. */ @@ -88,72 +67,6 @@ static void output_cursor_get_box(struct wlr_output_cursor *cursor, box->height = cursor->height; } -static void output_cursor_render(struct wlr_output_cursor *cursor, - pixman_region32_t *damage) { - struct wlr_renderer *renderer = cursor->output->renderer; - assert(renderer); - - struct wlr_texture *texture = cursor->texture; - if (texture == NULL) { - return; - } - - struct wlr_box box; - output_cursor_get_box(cursor, &box); - - pixman_region32_t surface_damage; - pixman_region32_init(&surface_damage); - pixman_region32_union_rect(&surface_damage, &surface_damage, box.x, box.y, - box.width, box.height); - pixman_region32_intersect(&surface_damage, &surface_damage, damage); - if (!pixman_region32_not_empty(&surface_damage)) { - goto surface_damage_finish; - } - - float matrix[9]; - wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, 0, - cursor->output->transform_matrix); - - int nrects; - pixman_box32_t *rects = pixman_region32_rectangles(&surface_damage, &nrects); - for (int i = 0; i < nrects; ++i) { - output_scissor(cursor->output, &rects[i]); - wlr_render_texture_with_matrix(renderer, texture, matrix, 1.0f); - } - wlr_renderer_scissor(renderer, NULL); - -surface_damage_finish: - pixman_region32_fini(&surface_damage); -} - -void wlr_output_render_software_cursors(struct wlr_output *output, - const pixman_region32_t *damage) { - int width, height; - wlr_output_transformed_resolution(output, &width, &height); - - pixman_region32_t render_damage; - pixman_region32_init(&render_damage); - pixman_region32_union_rect(&render_damage, &render_damage, 0, 0, - width, height); - if (damage != NULL) { - // Damage tracking supported - pixman_region32_intersect(&render_damage, &render_damage, damage); - } - - if (pixman_region32_not_empty(&render_damage)) { - struct wlr_output_cursor *cursor; - wl_list_for_each(cursor, &output->cursors, link) { - if (!cursor->enabled || !cursor->visible || - output->hardware_cursor == cursor) { - continue; - } - output_cursor_render(cursor, &render_damage); - } - } - - pixman_region32_fini(&render_damage); -} - void wlr_output_add_software_cursors_to_render_pass(struct wlr_output *output, struct wlr_render_pass *render_pass, const pixman_region32_t *damage) { int width, height; |