Blur damage compensation fixes (#259)

* Increased blur size to match what WayFire uses

* Fix damage compensation not being scaled
This commit is contained in:
Erik Reider 2023-12-28 11:10:05 +01:00 committed by GitHub
parent ca42d41453
commit 1c5c60d928
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View file

@ -1098,7 +1098,7 @@ void translate_keysyms(struct input_config *input_config) {
} }
int config_get_blur_size() { int config_get_blur_size() {
return pow(2, config->blur_params.num_passes) * config->blur_params.radius; return pow(2, config->blur_params.num_passes + 1) * config->blur_params.radius;
} }
bool config_should_parameters_blur() { bool config_should_parameters_blur() {

View file

@ -708,10 +708,15 @@ static void find_blurred_region_iterator(struct sway_container *con, void *data)
pixman_region32_t *blur_region = region_data->blur_region; pixman_region32_t *blur_region = region_data->blur_region;
if (con->blur_enabled && !view->surface->opaque) { if (con->blur_enabled && !view->surface->opaque) {
struct wlr_box region = {
.x = floor(con->current.x) - ws->output->lx,
.y = floor(con->current.y) - ws->output->ly,
.width = con->current.width,
.height = con->current.height,
};
scale_box(&region, ws->output->wlr_output->scale);
pixman_region32_union_rect(blur_region, blur_region, pixman_region32_union_rect(blur_region, blur_region,
floor(con->current.x) - ws->output->lx, region.x, region.y, region.width, region.height);
floor(con->current.y) - ws->output->ly,
con->current.width, con->current.height);
} }
} }
@ -732,9 +737,10 @@ bool workspace_get_blur_info(struct sway_workspace *ws, pixman_region32_t *blur_
wl_list_for_each(lsurface, &sway_output->layers[i], link) { wl_list_for_each(lsurface, &sway_output->layers[i], link) {
if (lsurface->has_blur && !lsurface->layer_surface->surface->opaque if (lsurface->has_blur && !lsurface->layer_surface->surface->opaque
&& lsurface->layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) { && lsurface->layer != ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND) {
struct wlr_box *geo = &lsurface->geo; struct wlr_box geo = lsurface->geo;
scale_box(&geo, sway_output->wlr_output->scale);
pixman_region32_union_rect(blur_region, blur_region, pixman_region32_union_rect(blur_region, blur_region,
geo->x, geo->y, geo->width, geo->height); geo.x, geo.y, geo.width, geo.height);
} }
} }
} }