fix: gray background rect not being expanded by blur size (#295)

This commit is contained in:
Erik Reider 2024-04-22 23:41:51 +02:00 committed by GitHub
parent 4b954d5a05
commit a5a69d4d4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1592,9 +1592,6 @@ void output_render(struct fx_render_context *ctx) {
struct sway_output *output = ctx->output;
pixman_region32_t *damage = ctx->output_damage;
pixman_region32_t transformed_damage;
pixman_region32_init(&transformed_damage);
struct fx_effect_framebuffers *effect_fbos = ctx->pass->fx_effect_framebuffers;
struct sway_workspace *workspace = output->current.active_workspace;
@ -1609,7 +1606,7 @@ void output_render(struct fx_render_context *ctx) {
if (!pixman_region32_not_empty(damage)) {
// Output isn't damaged but needs buffer swap
goto renderer_end;
return;
}
if (debug.damage == DAMAGE_HIGHLIGHT) {
@ -1620,6 +1617,9 @@ void output_render(struct fx_render_context *ctx) {
},
});
}
pixman_region32_t transformed_damage;
pixman_region32_init(&transformed_damage);
pixman_region32_copy(&transformed_damage, damage);
transform_output_damage(&transformed_damage, wlr_output);
@ -1715,17 +1715,9 @@ void output_render(struct fx_render_context *ctx) {
// copy the surrounding content where the blur would display artifacts
// and draw it above the artifacts
// ensure that the damage isn't expanding past the output's size
int32_t damage_width = damage->extents.x2 - damage->extents.x1;
int32_t damage_height = damage->extents.y2 - damage->extents.y1;
if (damage_width > output_width || damage_height > output_height) {
pixman_region32_intersect_rect(damage, damage,
0, 0, output_width, output_height);
} else {
// Expand the original damage to compensate for surrounding
// blurred views to avoid sharp edges between damage regions
wlr_region_expand(damage, damage, config_get_blur_size());
}
// Expand the original damage to compensate for surrounding
// blurred views to avoid sharp edges between damage regions
wlr_region_expand(damage, damage, config_get_blur_size());
pixman_region32_t extended_damage;
pixman_region32_init(&extended_damage);
@ -1743,6 +1735,10 @@ void output_render(struct fx_render_context *ctx) {
pixman_region32_union(damage, damage, &extended_damage);
pixman_region32_fini(&extended_damage);
// Copy the new extended damage into the transformed damage
pixman_region32_copy(&transformed_damage, damage);
transform_output_damage(&transformed_damage, wlr_output);
// Capture the padding pixels before blur for later use
fx_renderer_read_to_buffer(ctx->pass, &effect_fbos->blur_padding_region,
effect_fbos->blur_saved_pixels_buffer,