style: moved border_thickness out of render_shadow

This commit is contained in:
Will McKinnon 2023-04-15 19:55:47 -04:00
parent 8d3b7e13df
commit 7d774f769c

View file

@ -329,7 +329,7 @@ damage_finish:
// _box.width and .height are expected to be output-buffer-local // _box.width and .height are expected to be output-buffer-local
void render_box_shadow(struct sway_output *output, pixman_region32_t *output_damage, void render_box_shadow(struct sway_output *output, pixman_region32_t *output_damage,
const struct wlr_box *_box, const float color[static 4], const struct wlr_box *_box, const float color[static 4],
float blur_sigma, float corner_radius, float border_thickness) { float blur_sigma, float corner_radius) {
struct wlr_output *wlr_output = output->wlr_output; struct wlr_output *wlr_output = output->wlr_output;
struct fx_renderer *renderer = output->server->renderer; struct fx_renderer *renderer = output->server->renderer;
@ -340,9 +340,6 @@ void render_box_shadow(struct sway_output *output, pixman_region32_t *output_dam
box.width += 2 * blur_sigma; box.width += 2 * blur_sigma;
box.height += 2 * blur_sigma; box.height += 2 * blur_sigma;
// Uses the outer radii of the window for a more realistic look
corner_radius += border_thickness;
pixman_region32_t damage = create_damage(box, output_damage); pixman_region32_t damage = create_damage(box, output_damage);
// don't damage area behind window since we dont render it anyway // don't damage area behind window since we dont render it anyway
@ -490,29 +487,28 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage,
render_view_toplevels(view, output, damage, deco_data); render_view_toplevels(view, output, damage, deco_data);
} }
struct sway_container_state *state = &con->current;
// Only draw shadows on CSD windows if shadows_on_csd is enabled // Only draw shadows on CSD windows if shadows_on_csd is enabled
if (con->current.border == B_CSD && !config->shadows_on_csd_enabled) { if (state->border == B_CSD && !config->shadows_on_csd_enabled) {
return; return;
} }
// render shadow // render shadow
if (con->shadow_enabled && config->shadow_blur_sigma > 0 && config->shadow_color[3] > 0.0) { if (con->shadow_enabled && config->shadow_blur_sigma > 0 && config->shadow_color[3] > 0.0) {
struct sway_container_state *state = &con->current;
struct wlr_box box = { floor(state->x), floor(state->y), state->width, state->height }; struct wlr_box box = { floor(state->x), floor(state->y), state->width, state->height };
scale_box(&box, output->wlr_output->scale); scale_box(&box, output->wlr_output->scale);
render_box_shadow(output, damage, &box, config->shadow_color, render_box_shadow(output, damage, &box, config->shadow_color, config->shadow_blur_sigma,
config->shadow_blur_sigma, con->corner_radius, con->corner_radius + state->border_thickness);
state->border_thickness);
} }
if (con->current.border == B_NONE || con->current.border == B_CSD) { if (state->border == B_NONE || state->border == B_CSD) {
return; return;
} }
struct wlr_box box; struct wlr_box box;
float output_scale = output->wlr_output->scale; float output_scale = output->wlr_output->scale;
float color[4]; float color[4];
struct sway_container_state *state = &con->current;
if (state->border_left) { if (state->border_left) {
memcpy(&color, colors->child_border, sizeof(float) * 4); memcpy(&color, colors->child_border, sizeof(float) * 4);