scene: add wlr_scene_buffer

This new scene-graph node displays a wlr_buffer.

Closes: https://github.com/swaywm/wlroots/issues/3161
This commit is contained in:
Simon Ser 2021-09-20 16:05:19 +02:00 committed by Simon Zeni
parent f6f0e010d1
commit 7939bf8cc6
2 changed files with 92 additions and 2 deletions

View file

@ -31,6 +31,7 @@ enum wlr_scene_node_type {
WLR_SCENE_NODE_TREE,
WLR_SCENE_NODE_SURFACE,
WLR_SCENE_NODE_RECT,
WLR_SCENE_NODE_BUFFER,
};
struct wlr_scene_node_state {
@ -85,6 +86,16 @@ struct wlr_scene_rect {
float color[4];
};
/** A scene-graph node displaying a buffer */
struct wlr_scene_buffer {
struct wlr_scene_node node;
struct wlr_buffer *buffer;
// private state
struct wlr_texture *texture;
};
/** A viewport for an output in the scene-graph */
struct wlr_scene_output {
struct wlr_output *output;
@ -194,6 +205,12 @@ 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 buffer to the scene-graph.
*/
struct wlr_scene_buffer *wlr_scene_buffer_create(struct wlr_scene_node *parent,
struct wlr_buffer *buffer);
/**
* Add a viewport for the specified output to the scene-graph.
*