diff options
author | William McKinnon <[email protected]> | 2023-05-16 02:26:01 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2023-05-16 02:26:01 -0400 |
commit | 2c4fe20456851b6b8dc14b6bdc0cf9bee527a9ee (patch) | |
tree | c9e8a650da8a23c849516a6ac54dd59527681693 /sway/desktop/output.c | |
parent | 479cc4e7456a93aed1a89bef8d83c1f8c43bd291 (diff) |
Blur damage tracking simplification (#155)
* suplified conditional in find_con_effect_iterator
* removed has_blur
* simplified optimized blur check
* moved damage expansion to output.c
* removed extraneous fx_renderer_scissor
* cleaned up render_output
* removed unneeded damage scale
* moved workspace optimized check function to workspace.c
* renamed ws iterator function
* added back region expansion
* removed uneeded parameter from get_main_buffer_blur
* returned extended damage
* moved get_blur_size back to original spot (reduce diff size)
* Fixed blur artifacting
* Fixed damage highlight not clearing correct framebuffer
* removed unneeded conditional
* moved initial damage expansion to output.c
* moved extended damage to the top of output_render
* moved blur damage to damage_surface_iterator
* ensure damage doesnt expand beyond output size
* removed stdint import
---------
Co-authored-by: Erik Reider <[email protected]>
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 45c2f1c4..45bbf0b8 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -689,6 +689,16 @@ static void damage_surface_iterator(struct sway_output *output, ceil(output->wlr_output->scale) - surface->current.scale); } pixman_region32_translate(&damage, box.x, box.y); + + if (view) { + int blur_size = view->container->blur_enabled ? config_get_blur_size() : 0; + wlr_region_expand(&damage, &damage, blur_size); + box.x -= blur_size; + box.y -= blur_size; + box.width += blur_size * 2; + box.height += blur_size * 2; + } + if (wlr_damage_ring_add(&output->damage_ring, &damage)) { wlr_output_schedule_frame(output->wlr_output); } @@ -745,12 +755,14 @@ static void damage_child_views_iterator(struct sway_container *con, void output_damage_whole_container(struct sway_output *output, struct sway_container *con) { + int shadow_sigma = con->shadow_enabled ? config->shadow_blur_sigma : 0; + // Pad the box by 1px, because the width is a double and might be a fraction struct wlr_box box = { - .x = con->current.x - output->lx - 1, - .y = con->current.y - output->ly - 1, - .width = con->current.width + 2, - .height = con->current.height + 2, + .x = con->current.x - output->lx - 1 - shadow_sigma, + .y = con->current.y - output->ly - 1 - shadow_sigma, + .width = con->current.width + 2 + shadow_sigma * 2, + .height = con->current.height + 2 + shadow_sigma * 2, }; scale_box(&box, output->wlr_output->scale); if (wlr_damage_ring_add_box(&output->damage_ring, &box)) { @@ -973,7 +985,6 @@ void handle_new_output(struct wl_listener *listener, void *data) { transaction_commit_dirty(); - // From sway upstream (fixes damage_ring bounds being INT_MAX) int width, height; wlr_output_transformed_resolution(output->wlr_output, &width, &height); wlr_damage_ring_set_bounds(&output->damage_ring, width, height); |