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,10 +335,20 @@ static void transform_output_box(struct wlr_box *box, const struct render_data *
static void scene_output_damage(struct wlr_scene_output *scene_output,
const pixman_region32_t *region) {
if (wlr_damage_ring_add(&scene_output->damage_ring, region)) {
int width, height;
wlr_output_transformed_resolution(scene_output->output, &width, &height);
pixman_region32_t clipped;
pixman_region32_init(&clipped);
pixman_region32_intersect_rect(&clipped, region, 0, 0, width, height);
if (!pixman_region32_not_empty(&clipped)) {
pixman_region32_fini(&clipped);
return;
}
wlr_damage_ring_add(&scene_output->damage_ring, &clipped);
pixman_region32_fini(&clipped);
wlr_output_schedule_frame(scene_output->output);
struct wlr_output *output = scene_output->output;
@ -354,14 +364,14 @@ static void scene_output_damage(struct wlr_scene_output *scene_output,
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) {
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_init_rect(&damage, 0, 0, ring->width, ring->height);
pixman_region32_init_rect(&damage, 0, 0, width, height);
scene_output_damage(scene_output, &damage);
pixman_region32_fini(&damage);
}

Loading…
Cancel
Save