mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 14:15:58 +01:00
output/cursor: drop legacy rendering API
This commit is contained in:
parent
40633ae7fd
commit
0c83c331ca
1 changed files with 0 additions and 87 deletions
|
@ -56,27 +56,6 @@ void wlr_output_lock_software_cursors(struct wlr_output *output, bool lock) {
|
||||||
// again.
|
// 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.
|
* 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;
|
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,
|
void wlr_output_add_software_cursors_to_render_pass(struct wlr_output *output,
|
||||||
struct wlr_render_pass *render_pass, const pixman_region32_t *damage) {
|
struct wlr_render_pass *render_pass, const pixman_region32_t *damage) {
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
Loading…
Reference in a new issue