Merge branch 'master' into move-to-wlr_buffer

This commit is contained in:
Erik Reider 2023-12-17 01:06:40 +01:00
commit ff0ced7254
2 changed files with 46 additions and 4 deletions

View file

@ -517,6 +517,12 @@ void fx_renderer_stencil_mask_fini() {
bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer, struct wlr_texture *wlr_texture, bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer, struct wlr_texture *wlr_texture,
const struct wlr_fbox *src_box, const struct wlr_box *dst_box, const float matrix[static 9], const struct wlr_fbox *src_box, const struct wlr_box *dst_box, const float matrix[static 9],
struct decoration_data deco_data) { struct decoration_data deco_data) {
// Fixes corner radii not being "round" when the radii is larger than
// the height/width
int min_size = MIN(dst_box->height, dst_box->width) * 0.5;
if (deco_data.corner_radius > min_size) {
deco_data.corner_radius = min_size;
}
struct wlr_gles2_texture_attribs *texture_attrs = malloc(sizeof(struct wlr_gles2_texture_attribs)); struct wlr_gles2_texture_attribs *texture_attrs = malloc(sizeof(struct wlr_gles2_texture_attribs));
fx_renderer_get_texture_attribs(wlr_texture, texture_attrs); fx_renderer_get_texture_attribs(wlr_texture, texture_attrs);
@ -673,6 +679,13 @@ void fx_render_rounded_rect(struct fx_renderer *renderer, const struct wlr_box *
} }
assert(box->width > 0 && box->height > 0); assert(box->width > 0 && box->height > 0);
// Fixes corner radii not being "round" when the radii is larger than
// the height/width
int min_size = MIN(box->height, box->width) * 0.5;
if (radius > min_size) {
radius = min_size;
}
struct rounded_quad_shader *shader = NULL; struct rounded_quad_shader *shader = NULL;
switch (corner_location) { switch (corner_location) {
@ -734,6 +747,13 @@ void fx_render_border_corner(struct fx_renderer *renderer, const struct wlr_box
} }
assert(box->width > 0 && box->height > 0); assert(box->width > 0 && box->height > 0);
// Fixes corner radii not being "round" when the radii is larger than
// the height/width
int min_size = MIN(box->height, box->width) * 0.5;
if (radius > min_size) {
radius = min_size;
}
float gl_matrix[9]; float gl_matrix[9];
wlr_matrix_multiply(gl_matrix, renderer->projection, matrix); wlr_matrix_multiply(gl_matrix, renderer->projection, matrix);
@ -782,6 +802,13 @@ void fx_render_stencil_mask(struct fx_renderer *renderer, const struct wlr_box *
} }
assert(box->width > 0 && box->height > 0); assert(box->width > 0 && box->height > 0);
// Fixes corner radii not being "round" when the radii is larger than
// the height/width
int min_size = MIN(box->height, box->width) * 0.5;
if (corner_radius > min_size) {
corner_radius = min_size;
}
// TODO: just pass gl_matrix? // TODO: just pass gl_matrix?
float gl_matrix[9]; float gl_matrix[9];
wlr_matrix_multiply(gl_matrix, renderer->projection, matrix); wlr_matrix_multiply(gl_matrix, renderer->projection, matrix);
@ -823,6 +850,13 @@ void fx_render_box_shadow(struct fx_renderer *renderer,
} }
assert(box->width > 0 && box->height > 0); assert(box->width > 0 && box->height > 0);
// Fixes corner radii not being "round" when the radii is larger than
// the height/width
int min_size = MIN(box->height, box->width) * 0.5;
if (corner_radius > min_size) {
corner_radius = min_size;
}
float gl_matrix[9]; float gl_matrix[9];
wlr_matrix_multiply(gl_matrix, renderer->projection, matrix); wlr_matrix_multiply(gl_matrix, renderer->projection, matrix);

View file

@ -467,8 +467,12 @@ static void render_surface_iterator(struct sway_output *output,
struct wlr_box monitor_box = get_monitor_box(wlr_output); struct wlr_box monitor_box = get_monitor_box(wlr_output);
wlr_box_transform(&monitor_box, &monitor_box, wlr_box_transform(&monitor_box, &monitor_box,
wlr_output_transform_invert(wlr_output->transform), monitor_box.width, monitor_box.height); wlr_output_transform_invert(wlr_output->transform), monitor_box.width, monitor_box.height);
struct blur_stencil_data stencil_data = { texture, &src_box, matrix }; struct blur_stencil_data stencil_data = {
bool should_optimize_blur = view ? !container_is_floating(view->container) || config->blur_xray : false; texture,
&src_box,
matrix,
};
bool should_optimize_blur = view ? !container_is_floating_or_child(view->container) || config->blur_xray : false;
render_blur(should_optimize_blur, output, output_damage, &dst_box, render_blur(should_optimize_blur, output, output_damage, &dst_box,
&opaque_region, &deco_data, &stencil_data); &opaque_region, &deco_data, &stencil_data);
} }
@ -846,8 +850,12 @@ static void render_saved_view(struct sway_view *view, struct sway_output *output
struct wlr_box monitor_box = get_monitor_box(wlr_output); struct wlr_box monitor_box = get_monitor_box(wlr_output);
wlr_box_transform(&monitor_box, &monitor_box, wlr_box_transform(&monitor_box, &monitor_box,
wlr_output_transform_invert(wlr_output->transform), monitor_box.width, monitor_box.height); wlr_output_transform_invert(wlr_output->transform), monitor_box.width, monitor_box.height);
struct blur_stencil_data stencil_data = { saved_buf->buffer->texture, &saved_buf->source_box, matrix }; struct blur_stencil_data stencil_data = {
bool should_optimize_blur = !container_is_floating(view->container) || config->blur_xray; saved_buf->buffer->texture,
&saved_buf->source_box,
matrix,
};
bool should_optimize_blur = !container_is_floating_or_child(view->container) || config->blur_xray;
render_blur(should_optimize_blur, output, damage, &dst_box, &opaque_region, render_blur(should_optimize_blur, output, damage, &dst_box, &opaque_region,
&deco_data, &stencil_data); &deco_data, &stencil_data);