scene: Don't rely on return value of wlr_damage_ring_add

master
Alexander Orzechowski 3 months ago committed by itycodes
parent 9e42f8c238
commit 89b45be43b

@ -335,33 +335,43 @@ static void transform_output_box(struct wlr_box *box, const struct render_data *
static void scene_output_damage(struct wlr_scene_output *scene_output, static void scene_output_damage(struct wlr_scene_output *scene_output,
const pixman_region32_t *region) { const pixman_region32_t *region) {
if (wlr_damage_ring_add(&scene_output->damage_ring, region)) { int width, height;
int width, height; wlr_output_transformed_resolution(scene_output->output, &width, &height);
wlr_output_transformed_resolution(scene_output->output, &width, &height);
wlr_output_schedule_frame(scene_output->output); pixman_region32_t clipped;
pixman_region32_init(&clipped);
pixman_region32_intersect_rect(&clipped, region, 0, 0, width, height);
struct wlr_output *output = scene_output->output; if (!pixman_region32_not_empty(&clipped)) {
enum wl_output_transform transform = pixman_region32_fini(&clipped);
wlr_output_transform_invert(scene_output->output->transform); return;
}
pixman_region32_t frame_damage; wlr_damage_ring_add(&scene_output->damage_ring, &clipped);
pixman_region32_init(&frame_damage); pixman_region32_fini(&clipped);
wlr_region_transform(&frame_damage, region, transform, width, height); wlr_output_schedule_frame(scene_output->output);
pixman_region32_union(&scene_output->pending_commit_damage, struct wlr_output *output = scene_output->output;
&scene_output->pending_commit_damage, &frame_damage); enum wl_output_transform transform =
pixman_region32_intersect_rect(&scene_output->pending_commit_damage, wlr_output_transform_invert(scene_output->output->transform);
&scene_output->pending_commit_damage, 0, 0, output->width, output->height);
pixman_region32_fini(&frame_damage); pixman_region32_t frame_damage;
} pixman_region32_init(&frame_damage);
wlr_region_transform(&frame_damage, region, transform, width, height);
pixman_region32_union(&scene_output->pending_commit_damage,
&scene_output->pending_commit_damage, &frame_damage);
pixman_region32_intersect_rect(&scene_output->pending_commit_damage,
&scene_output->pending_commit_damage, 0, 0, output->width, output->height);
pixman_region32_fini(&frame_damage);
} }
static void scene_output_damage_whole(struct wlr_scene_output *scene_output) { static void scene_output_damage_whole(struct wlr_scene_output *scene_output) {
struct wlr_damage_ring *ring = &scene_output->damage_ring; int width, height;
wlr_output_transformed_resolution(scene_output->output, &width, &height);
pixman_region32_t damage; pixman_region32_t damage;
pixman_region32_init_rect(&damage, 0, 0, ring->width, ring->height); pixman_region32_init_rect(&damage, 0, 0, width, height);
scene_output_damage(scene_output, &damage); scene_output_damage(scene_output, &damage);
pixman_region32_fini(&damage); pixman_region32_fini(&damage);
} }

Loading…
Cancel
Save