mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-24 08:02:21 +00:00
damage_ring: Remove return value of wlr_damage_ring_add/wlr_damage_ring_add_box
Compositors should compute whether the damage is part of the output themselves.
This commit is contained in:
parent
fbafd8ed94
commit
502eb38d80
@ -54,18 +54,14 @@ void wlr_damage_ring_set_bounds(struct wlr_damage_ring *ring,
|
||||
|
||||
/**
|
||||
* Add a region to the current damage.
|
||||
*
|
||||
* Returns true if the region intersects the ring bounds, false otherwise.
|
||||
*/
|
||||
bool wlr_damage_ring_add(struct wlr_damage_ring *ring,
|
||||
void wlr_damage_ring_add(struct wlr_damage_ring *ring,
|
||||
const pixman_region32_t *damage);
|
||||
|
||||
/**
|
||||
* Add a box to the current damage.
|
||||
*
|
||||
* Returns true if the box intersects the ring bounds, false otherwise.
|
||||
*/
|
||||
bool wlr_damage_ring_add_box(struct wlr_damage_ring *ring,
|
||||
void wlr_damage_ring_add_box(struct wlr_damage_ring *ring,
|
||||
const struct wlr_box *box);
|
||||
|
||||
/**
|
||||
|
@ -49,35 +49,16 @@ void wlr_damage_ring_set_bounds(struct wlr_damage_ring *ring,
|
||||
wlr_damage_ring_add_whole(ring);
|
||||
}
|
||||
|
||||
bool wlr_damage_ring_add(struct wlr_damage_ring *ring,
|
||||
void wlr_damage_ring_add(struct wlr_damage_ring *ring,
|
||||
const pixman_region32_t *damage) {
|
||||
pixman_region32_t clipped;
|
||||
pixman_region32_init(&clipped);
|
||||
pixman_region32_intersect_rect(&clipped, damage,
|
||||
0, 0, ring->width, ring->height);
|
||||
bool intersects = pixman_region32_not_empty(&clipped);
|
||||
if (intersects) {
|
||||
pixman_region32_union(&ring->current, &ring->current, &clipped);
|
||||
}
|
||||
pixman_region32_fini(&clipped);
|
||||
return intersects;
|
||||
pixman_region32_union(&ring->current, &ring->current, damage);
|
||||
}
|
||||
|
||||
bool wlr_damage_ring_add_box(struct wlr_damage_ring *ring,
|
||||
void wlr_damage_ring_add_box(struct wlr_damage_ring *ring,
|
||||
const struct wlr_box *box) {
|
||||
struct wlr_box clipped = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = ring->width,
|
||||
.height = ring->height,
|
||||
};
|
||||
if (wlr_box_intersection(&clipped, &clipped, box)) {
|
||||
pixman_region32_union_rect(&ring->current,
|
||||
&ring->current, clipped.x, clipped.y,
|
||||
clipped.width, clipped.height);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
pixman_region32_union_rect(&ring->current,
|
||||
&ring->current, box->x, box->y,
|
||||
box->width, box->height);
|
||||
}
|
||||
|
||||
void wlr_damage_ring_add_whole(struct wlr_damage_ring *ring) {
|
||||
|
Loading…
Reference in New Issue
Block a user