removed scaled_dst box

This commit is contained in:
William McKinnon 2023-06-05 20:35:20 -04:00
parent abd42739a0
commit c1a1d80764

View file

@ -282,13 +282,9 @@ void render_blur(bool optimized, struct sway_output *output,
int corner_radius, bool should_round_top) {
struct wlr_output *wlr_output = output->wlr_output;
struct fx_renderer *renderer = output->renderer;
struct wlr_box scaled_dst_box;
memcpy(&scaled_dst_box, dst_box, sizeof(struct wlr_box));
scale_box(&scaled_dst_box, wlr_output->scale);
// Check if damage is inside of box rect
pixman_region32_t damage = create_damage(scaled_dst_box, output_damage);
pixman_region32_t damage = create_damage(*dst_box, output_damage);
pixman_region32_t translucent_region;
pixman_region32_init(&translucent_region);
@ -297,16 +293,8 @@ void render_blur(bool optimized, struct sway_output *output,
goto damage_finish;
}
/*
* Capture the back_buffer and blur it
*/
pixman_box32_t surface_box = {
.x2 = dst_box->width,
.y2 = dst_box->height,
};
// Gets the non opaque region
// Gets the translucent region
pixman_box32_t surface_box = { 0, 0, dst_box->width, dst_box->height };
pixman_region32_copy(&translucent_region, opaque_region);
pixman_region32_inverse(&translucent_region, &translucent_region, &surface_box);
if (!pixman_region32_not_empty(&translucent_region)) {
@ -317,7 +305,7 @@ void render_blur(bool optimized, struct sway_output *output,
struct fx_framebuffer *buffer = &renderer->blur_buffer;
if (!buffer->texture.id || !optimized) {
pixman_region32_translate(&translucent_region, scaled_dst_box.x, scaled_dst_box.y);
pixman_region32_translate(&translucent_region, dst_box->x, dst_box->y);
pixman_region32_intersect(&translucent_region, &translucent_region, &damage);
// Render the blur into its own buffer
@ -333,7 +321,7 @@ void render_blur(bool optimized, struct sway_output *output,
struct decoration_data deco_data = get_undecorated_decoration_data();
deco_data.corner_radius = corner_radius;
deco_data.has_titlebar = should_round_top;
render_texture(wlr_output, &damage, &buffer->texture, src_box, &scaled_dst_box, matrix, deco_data);
render_texture(wlr_output, &damage, &buffer->texture, src_box, dst_box, matrix, deco_data);
damage_finish:
pixman_region32_fini(&damage);
@ -424,6 +412,7 @@ static void render_surface_iterator(struct sway_output *output,
dst_box.x = fmax(dst_box.x, clip_box->x);
dst_box.y = fmax(dst_box.y, clip_box->y);
}
scale_box(&dst_box, wlr_output->scale);
struct decoration_data deco_data = data->deco_data;
deco_data.corner_radius *= wlr_output->scale;
@ -457,7 +446,6 @@ static void render_surface_iterator(struct sway_output *output,
}
// Render surface texture
scale_box(&dst_box, wlr_output->scale);
struct wlr_fbox src_box;
wlr_surface_get_buffer_source_box(surface, &src_box);
struct fx_texture fx_texture = fx_texture_from_wlr_texture(texture);
@ -786,6 +774,7 @@ static void render_saved_view(struct sway_view *view, struct sway_output *output
dst_box.width -= state.border_thickness * 2;
dst_box.height -= state.border_thickness * 2;
}
scale_box(&dst_box, wlr_output->scale);
deco_data.corner_radius *= wlr_output->scale;
@ -812,7 +801,6 @@ static void render_saved_view(struct sway_view *view, struct sway_output *output
}
// Render saved surface texture
scale_box(&dst_box, wlr_output->scale);
struct fx_texture fx_texture = fx_texture_from_wlr_texture(saved_buf->buffer->texture);
render_texture(wlr_output, damage, &fx_texture,
&saved_buf->source_box, &dst_box, matrix, deco_data);