summaryrefslogtreecommitdiff
path: root/types
diff options
context:
space:
mode:
Diffstat (limited to 'types')
-rw-r--r--types/fx/blur_data.c32
-rw-r--r--types/fx/meson.build3
-rw-r--r--types/scene/wlr_scene.c5
3 files changed, 37 insertions, 3 deletions
diff --git a/types/fx/blur_data.c b/types/fx/blur_data.c
new file mode 100644
index 0000000..3aa618b
--- /dev/null
+++ b/types/fx/blur_data.c
@@ -0,0 +1,32 @@
+#include "scenefx/types/fx/blur_data.h"
+
+struct blur_data blur_data_get_default(void) {
+ return (struct blur_data) {
+ .radius = 5,
+ .num_passes = 3,
+ .noise = 0.02,
+ .brightness = 0.9,
+ .contrast = 0.9,
+ .saturation = 1.1,
+ };
+}
+
+bool blur_data_should_parameters_blur_effects(struct blur_data *blur_data) {
+ return blur_data->brightness != 1.0f
+ || blur_data->saturation != 1.0f
+ || blur_data->contrast != 1.0f
+ || blur_data->noise > 0.0f;
+}
+
+bool blur_data_cmp(struct blur_data *a, struct blur_data *b) {
+ return a->radius == b->radius &&
+ a->num_passes && b->num_passes &&
+ a->noise == b->noise &&
+ a->brightness == b->brightness &&
+ a->contrast == b->contrast &&
+ a->saturation == b->saturation;
+}
+
+int blur_data_calc_size(struct blur_data *blur_data) {
+ return pow(2, blur_data->num_passes + 1) * blur_data->radius;
+}
diff --git a/types/fx/meson.build b/types/fx/meson.build
index b7f0207..2170f35 100644
--- a/types/fx/meson.build
+++ b/types/fx/meson.build
@@ -1,3 +1,4 @@
wlr_files += files(
- 'shadow_data.c'
+ 'shadow_data.c',
+ 'blur_data.c',
)
diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c
index 266dc63..0545e70 100644
--- a/types/scene/wlr_scene.c
+++ b/types/scene/wlr_scene.c
@@ -1312,6 +1312,7 @@ static void scene_entry_render(struct render_list_entry *entry, const struct ren
.clip_box = &xdg_box,
.corner_radius = scene_buffer->corner_radius * data->scale,
};
+
fx_render_pass_add_texture(data->render_pass, &tex_options);
struct wlr_scene_output_sample_event sample_event = {
@@ -1919,8 +1920,8 @@ bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
}
struct fx_gles_render_pass *render_pass =
- fx_renderer_begin_buffer_pass(output->renderer, buffer,
- &(struct wlr_buffer_pass_options){
+ fx_renderer_begin_buffer_pass(output->renderer, buffer, output,
+ &(struct wlr_buffer_pass_options) {
.timer = timer ? timer->render_timer : NULL,
}
);