mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
scene: simplify scene_node_update() condition when setting buffer
This commit is contained in:
parent
2d97935e82
commit
c79ed0706d
1 changed files with 10 additions and 11 deletions
|
@ -666,17 +666,16 @@ void wlr_scene_buffer_set_buffer_with_damage(struct wlr_scene_buffer *scene_buff
|
||||||
// coordinates.
|
// coordinates.
|
||||||
assert(buffer || !damage);
|
assert(buffer || !damage);
|
||||||
|
|
||||||
bool update = false;
|
bool mapped = buffer != NULL;
|
||||||
if (buffer) {
|
bool prev_mapped = scene_buffer->buffer != NULL || scene_buffer->texture != NULL;
|
||||||
|
|
||||||
// if this node used to not be mapped or its previous displayed
|
// if this node used to not be mapped or its previous displayed
|
||||||
// buffer region will be different from what the new buffer would
|
// buffer region will be different from what the new buffer would
|
||||||
// produce we need to update the node.
|
// produce we need to update the node.
|
||||||
update = (!scene_buffer->buffer && !scene_buffer->texture) ||
|
bool update = mapped != prev_mapped;
|
||||||
(scene_buffer->dst_width == 0 && scene_buffer->dst_height == 0 &&
|
if (buffer != NULL && scene_buffer->dst_width == 0 && scene_buffer->dst_height == 0) {
|
||||||
(scene_buffer->buffer_width != buffer->width ||
|
update = update || scene_buffer->buffer_width != buffer->width ||
|
||||||
scene_buffer->buffer_height != buffer->height));
|
scene_buffer->buffer_height != buffer->height;
|
||||||
} else {
|
|
||||||
update = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_texture_destroy(scene_buffer->texture);
|
wlr_texture_destroy(scene_buffer->texture);
|
||||||
|
|
Loading…
Reference in a new issue