mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
wlr_scene: Allow buffer in wlr_scene_buffer to be NULL
This is useful to emulate an unmapped surface.
This commit is contained in:
parent
8fe3aa29da
commit
039a31df9a
2 changed files with 11 additions and 2 deletions
|
@ -107,6 +107,8 @@ struct wlr_scene_rect {
|
|||
/** A scene-graph node displaying a buffer */
|
||||
struct wlr_scene_buffer {
|
||||
struct wlr_scene_node node;
|
||||
|
||||
// May be NULL
|
||||
struct wlr_buffer *buffer;
|
||||
|
||||
// private state
|
||||
|
@ -267,6 +269,8 @@ void wlr_scene_rect_set_color(struct wlr_scene_rect *rect, const float color[sta
|
|||
|
||||
/**
|
||||
* Add a node displaying a buffer to the scene-graph.
|
||||
*
|
||||
* If the buffer is NULL, this node will not be displayed.
|
||||
*/
|
||||
struct wlr_scene_buffer *wlr_scene_buffer_create(struct wlr_scene_node *parent,
|
||||
struct wlr_buffer *buffer);
|
||||
|
|
|
@ -358,7 +358,9 @@ struct wlr_scene_buffer *wlr_scene_buffer_create(struct wlr_scene_node *parent,
|
|||
}
|
||||
scene_node_init(&scene_buffer->node, WLR_SCENE_NODE_BUFFER, parent);
|
||||
|
||||
scene_buffer->buffer = wlr_buffer_lock(buffer);
|
||||
if (buffer) {
|
||||
scene_buffer->buffer = wlr_buffer_lock(buffer);
|
||||
}
|
||||
|
||||
scene_node_damage_whole(&scene_buffer->node);
|
||||
|
||||
|
@ -447,7 +449,7 @@ static void scene_node_get_size(struct wlr_scene_node *node,
|
|||
if (scene_buffer->dst_width > 0 && scene_buffer->dst_height > 0) {
|
||||
*width = scene_buffer->dst_width;
|
||||
*height = scene_buffer->dst_height;
|
||||
} else {
|
||||
} else if (scene_buffer->buffer) {
|
||||
if (scene_buffer->transform & WL_OUTPUT_TRANSFORM_90) {
|
||||
*height = scene_buffer->buffer->width;
|
||||
*width = scene_buffer->buffer->height;
|
||||
|
@ -838,6 +840,9 @@ static void render_node_iterator(struct wlr_scene_node *node,
|
|||
break;
|
||||
case WLR_SCENE_NODE_BUFFER:;
|
||||
struct wlr_scene_buffer *scene_buffer = scene_buffer_from_node(node);
|
||||
if (!scene_buffer->buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct wlr_renderer *renderer = output->renderer;
|
||||
texture = scene_buffer_get_texture(scene_buffer, renderer);
|
||||
|
|
Loading…
Reference in a new issue