diff options
Diffstat (limited to 'include/scenefx')
| -rw-r--r-- | include/scenefx/render/pass.h | 9 | ||||
| -rw-r--r-- | include/scenefx/types/fx/shadow_data.h | 20 | ||||
| -rw-r--r-- | include/scenefx/types/wlr_scene.h | 51 | 
3 files changed, 48 insertions, 32 deletions
| diff --git a/include/scenefx/render/pass.h b/include/scenefx/render/pass.h index 0f1d27c..0e87833 100644 --- a/include/scenefx/render/pass.h +++ b/include/scenefx/render/pass.h @@ -4,7 +4,6 @@  #include <stdbool.h>  #include <wlr/render/pass.h>  #include <wlr/render/interface.h> -#include "scenefx/types/fx/shadow_data.h"  struct fx_gles_render_pass {  	struct wlr_render_pass base; @@ -62,13 +61,15 @@ struct fx_render_rect_grad_options {  };  struct fx_render_box_shadow_options { -	struct wlr_box shadow_box; -	struct wlr_box clip_box; +	struct wlr_box box; +	struct wlr_box window_box; +	int window_corner_radius;  	/* Clip region, leave NULL to disable clipping */  	const pixman_region32_t *clip; -	struct shadow_data *shadow_data; +	float blur_sigma;  	int corner_radius; +	struct wlr_render_color color;  };  struct fx_render_rounded_rect_options { diff --git a/include/scenefx/types/fx/shadow_data.h b/include/scenefx/types/fx/shadow_data.h deleted file mode 100644 index c307871..0000000 --- a/include/scenefx/types/fx/shadow_data.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef TYPES_DECORATION_DATA -#define TYPES_DECORATION_DATA - -#include <stdbool.h> -#include <wlr/util/addon.h> -#include <wlr/render/pass.h> - -struct shadow_data { -	bool enabled; -	struct wlr_render_color color; -	float blur_sigma; -	float offset_x; -	float offset_y; -}; - -struct shadow_data shadow_data_get_default(void); - -bool scene_buffer_has_shadow(struct shadow_data *data); - -#endif diff --git a/include/scenefx/types/wlr_scene.h b/include/scenefx/types/wlr_scene.h index 5925931..9b68c4b 100644 --- a/include/scenefx/types/wlr_scene.h +++ b/include/scenefx/types/wlr_scene.h @@ -20,7 +20,6 @@   */  #include <pixman.h> -#include "scenefx/types/fx/shadow_data.h"  #include <time.h>  #include <wayland-server-core.h>  #include <wlr/render/wlr_renderer.h> @@ -54,6 +53,7 @@ typedef void (*wlr_scene_buffer_iterator_func_t)(  enum wlr_scene_node_type {  	WLR_SCENE_NODE_TREE,  	WLR_SCENE_NODE_RECT, +	WLR_SCENE_NODE_SHADOW,  	WLR_SCENE_NODE_BUFFER,  }; @@ -140,6 +140,15 @@ struct wlr_scene_rect {  	float color[4];  }; +/** A scene-graph node displaying a shadow */ +struct wlr_scene_shadow { +	struct wlr_scene_node node; +	int width, height; +	int corner_radius; +	float color[4]; +	float blur_sigma; +}; +  struct wlr_scene_outputs_update_event {  	struct wlr_scene_output **active;  	size_t size; @@ -178,7 +187,6 @@ struct wlr_scene_buffer {  	float opacity;  	int corner_radius; -	struct shadow_data shadow_data;  	enum wlr_scale_filter_mode filter_mode;  	struct wlr_fbox src_box; @@ -359,6 +367,12 @@ struct wlr_scene_tree *wlr_scene_tree_from_node(struct wlr_scene_node *node);  struct wlr_scene_rect *wlr_scene_rect_from_node(struct wlr_scene_node *node);  /** + * If this node represents a wlr_scene_shadow, that shadow will be returned. It + * is not legal to feed a node that does not represent a wlr_scene_shadow. + */ +struct wlr_scene_shadow *wlr_scene_shadow_from_node(struct wlr_scene_node *node); + +/**   * If this buffer is backed by a surface, then the struct wlr_scene_surface is   * returned. If not, NULL will be returned.   */ @@ -382,6 +396,33 @@ void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, int width, int height)  void wlr_scene_rect_set_color(struct wlr_scene_rect *rect, const float color[static 4]);  /** + * Add a node displaying a shadow to the scene-graph. + */ +struct wlr_scene_shadow *wlr_scene_shadow_create(struct wlr_scene_tree *parent, +		int width, int height, int corner_radius, float blur_sigma, +		const float color[static 4]); + +/** + * Change the width and height of an existing shadow node. + */ +void wlr_scene_shadow_set_size(struct wlr_scene_shadow *shadow, int width, int height); + +/** + * Change the corner radius of an existing shadow node. + */ +void wlr_scene_shadow_set_corner_radius(struct wlr_scene_shadow *shadow, int corner_radius); + +/** + * Change the blur_sigma of an existing shadow node. + */ +void wlr_scene_shadow_set_blur_sigma(struct wlr_scene_shadow *shadow, float blur_sigma); + +/** + * Change the color of an existing shadow node. + */ +void wlr_scene_shadow_set_color(struct wlr_scene_shadow *shadow, const float color[static 4]); + +/**   * Add a node displaying a buffer to the scene-graph.   *   * If the buffer is NULL, this node will not be displayed. @@ -457,12 +498,6 @@ void wlr_scene_buffer_set_corner_radius(struct wlr_scene_buffer *scene_buffer,  		int radii);  /** -* Sets the shadow of this buffer -*/ -void wlr_scene_buffer_set_shadow_data(struct wlr_scene_buffer *scene_buffer, -		struct shadow_data shadow_data); - -/**   * Calls the buffer's frame_done signal.   */  void wlr_scene_buffer_send_frame_done(struct wlr_scene_buffer *scene_buffer, | 
