Add blur to tiling indicator (#252)
This commit is contained in:
parent
d1482ad992
commit
2bd366f337
|
@ -180,6 +180,8 @@ struct fx_renderer {
|
||||||
} shaders;
|
} shaders;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct decoration_data get_undecorated_decoration_data();
|
||||||
|
|
||||||
struct fx_renderer *fx_renderer_create(struct wlr_egl *egl, struct wlr_output *output);
|
struct fx_renderer *fx_renderer_create(struct wlr_egl *egl, struct wlr_output *output);
|
||||||
|
|
||||||
void fx_renderer_fini(struct fx_renderer *renderer);
|
void fx_renderer_fini(struct fx_renderer *renderer);
|
||||||
|
|
|
@ -19,6 +19,12 @@ struct render_data {
|
||||||
struct decoration_data deco_data;
|
struct decoration_data deco_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct blur_stencil_data {
|
||||||
|
struct fx_texture *stencil_texture;
|
||||||
|
const struct wlr_fbox *stencil_src_box;
|
||||||
|
float *stencil_matrix;
|
||||||
|
};
|
||||||
|
|
||||||
struct sway_output_state {
|
struct sway_output_state {
|
||||||
list_t *workspaces;
|
list_t *workspaces;
|
||||||
struct sway_workspace *active_workspace;
|
struct sway_workspace *active_workspace;
|
||||||
|
@ -184,6 +190,11 @@ void render_rounded_rect(struct sway_output *output,
|
||||||
float color[static 4], int corner_radius,
|
float color[static 4], int corner_radius,
|
||||||
enum corner_location corner_location);
|
enum corner_location corner_location);
|
||||||
|
|
||||||
|
void render_blur(bool optimized, struct sway_output *output,
|
||||||
|
pixman_region32_t *output_damage, const struct wlr_box *dst_box,
|
||||||
|
pixman_region32_t *opaque_region, struct decoration_data *deco_data,
|
||||||
|
struct blur_stencil_data *stencil_data);
|
||||||
|
|
||||||
|
|
||||||
void premultiply_alpha(float color[4], float opacity);
|
void premultiply_alpha(float color[4], float opacity);
|
||||||
|
|
||||||
|
|
|
@ -295,12 +295,6 @@ struct fx_framebuffer *get_main_buffer_blur(struct fx_renderer *renderer, struct
|
||||||
return current_buffer;
|
return current_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct blur_stencil_data {
|
|
||||||
struct fx_texture *stencil_texture;
|
|
||||||
const struct wlr_fbox *stencil_src_box;
|
|
||||||
float *stencil_matrix;
|
|
||||||
};
|
|
||||||
|
|
||||||
void render_blur(bool optimized, struct sway_output *output,
|
void render_blur(bool optimized, struct sway_output *output,
|
||||||
pixman_region32_t *output_damage, const struct wlr_box *dst_box,
|
pixman_region32_t *output_damage, const struct wlr_box *dst_box,
|
||||||
pixman_region32_t *opaque_region, struct decoration_data *deco_data,
|
pixman_region32_t *opaque_region, struct decoration_data *deco_data,
|
||||||
|
@ -336,7 +330,7 @@ void render_blur(bool optimized, struct sway_output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a stencil of the window ignoring transparent regions
|
// Get a stencil of the window ignoring transparent regions
|
||||||
if (deco_data->discard_transparent) {
|
if (deco_data->discard_transparent && stencil_data) {
|
||||||
fx_renderer_scissor(NULL);
|
fx_renderer_scissor(NULL);
|
||||||
fx_renderer_stencil_mask_init();
|
fx_renderer_stencil_mask_init();
|
||||||
|
|
||||||
|
@ -358,7 +352,7 @@ void render_blur(bool optimized, struct sway_output *output,
|
||||||
render_texture(wlr_output, &damage, &buffer->texture, NULL, dst_box, matrix, blur_deco_data);
|
render_texture(wlr_output, &damage, &buffer->texture, NULL, dst_box, matrix, blur_deco_data);
|
||||||
|
|
||||||
// Finish stenciling
|
// Finish stenciling
|
||||||
if (deco_data->discard_transparent) {
|
if (deco_data->discard_transparent && stencil_data) {
|
||||||
fx_renderer_stencil_mask_fini();
|
fx_renderer_stencil_mask_fini();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,16 @@ static void handle_render(struct sway_seat *seat,
|
||||||
struct wlr_box box;
|
struct wlr_box box;
|
||||||
memcpy(&box, &e->drop_box, sizeof(struct wlr_box));
|
memcpy(&box, &e->drop_box, sizeof(struct wlr_box));
|
||||||
scale_box(&box, output->wlr_output->scale);
|
scale_box(&box, output->wlr_output->scale);
|
||||||
|
|
||||||
|
// Render blur
|
||||||
|
pixman_region32_t opaque_region;
|
||||||
|
pixman_region32_init(&opaque_region);
|
||||||
|
struct decoration_data deco_data = get_undecorated_decoration_data();
|
||||||
|
deco_data.blur = e->con->blur_enabled;
|
||||||
|
deco_data.corner_radius = e->con->corner_radius;
|
||||||
|
render_blur(false, output, damage, &box, &opaque_region, &deco_data, NULL);
|
||||||
|
pixman_region32_fini(&opaque_region);
|
||||||
|
|
||||||
render_rounded_rect(output, damage, &box, color,
|
render_rounded_rect(output, damage, &box, color,
|
||||||
e->con->corner_radius * output->wlr_output->scale, ALL);
|
e->con->corner_radius * output->wlr_output->scale, ALL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue