compositor: drop wlr_surface.external_damage

master
Kirill Primak 11 months ago committed by Simon Ser
parent 56cc25185d
commit 7dfbd87771

@ -141,11 +141,6 @@ struct wlr_surface {
* positions need to be damaged. * positions need to be damaged.
*/ */
pixman_region32_t buffer_damage; pixman_region32_t buffer_damage;
/**
* The last commit's damage caused by surface and its subsurfaces'
* movement, in surface-local coordinates.
*/
pixman_region32_t external_damage;
/** /**
* The current opaque region, in surface-local coordinates. It is clipped to * The current opaque region, in surface-local coordinates. It is clipped to
* the surface bounds. If the surface's buffer is using a fully opaque * the surface bounds. If the surface's buffer is using a fully opaque
@ -404,10 +399,7 @@ void wlr_surface_for_each_surface(struct wlr_surface *surface,
wlr_surface_iterator_func_t iterator, void *user_data); wlr_surface_iterator_func_t iterator, void *user_data);
/** /**
* Get the effective surface damage in surface-local coordinate space. Besides * Get the effective surface damage in surface-local coordinate space.
* buffer damage, this includes damage induced by resizing and moving the
* surface and its subsurfaces. The resulting damage is not expected to be
* bounded by the surface itself.
*/ */
void wlr_surface_get_effective_damage(struct wlr_surface *surface, void wlr_surface_get_effective_damage(struct wlr_surface *surface,
pixman_region32_t *damage); pixman_region32_t *damage);

@ -39,7 +39,6 @@ struct wlr_subsurface {
bool has_cache; bool has_cache;
bool synchronized; bool synchronized;
bool reordered;
bool added; bool added;
struct wl_listener surface_client_commit; struct wl_listener surface_client_commit;

@ -531,15 +531,6 @@ static void surface_commit_state(struct wlr_surface *surface,
surface_update_damage(&surface->buffer_damage, &surface->current, next); surface_update_damage(&surface->buffer_damage, &surface->current, next);
pixman_region32_clear(&surface->external_damage);
if (surface->current.width > next->width ||
surface->current.height > next->height ||
next->dx != 0 || next->dy != 0) {
pixman_region32_union_rect(&surface->external_damage,
&surface->external_damage, -next->dx, -next->dy,
surface->current.width, surface->current.height);
}
surface->previous.scale = surface->current.scale; surface->previous.scale = surface->current.scale;
surface->previous.transform = surface->current.transform; surface->previous.transform = surface->current.transform;
surface->previous.width = surface->current.width; surface->previous.width = surface->current.width;
@ -761,7 +752,6 @@ static void surface_handle_resource_destroy(struct wl_resource *resource) {
surface_state_finish(&surface->pending); surface_state_finish(&surface->pending);
surface_state_finish(&surface->current); surface_state_finish(&surface->current);
pixman_region32_fini(&surface->buffer_damage); pixman_region32_fini(&surface->buffer_damage);
pixman_region32_fini(&surface->external_damage);
pixman_region32_fini(&surface->opaque_region); pixman_region32_fini(&surface->opaque_region);
pixman_region32_fini(&surface->input_region); pixman_region32_fini(&surface->input_region);
if (surface->buffer != NULL) { if (surface->buffer != NULL) {
@ -811,7 +801,6 @@ static struct wlr_surface *surface_create(struct wl_client *client,
wl_list_init(&surface->current_outputs); wl_list_init(&surface->current_outputs);
wl_list_init(&surface->cached); wl_list_init(&surface->cached);
pixman_region32_init(&surface->buffer_damage); pixman_region32_init(&surface->buffer_damage);
pixman_region32_init(&surface->external_damage);
pixman_region32_init(&surface->opaque_region); pixman_region32_init(&surface->opaque_region);
pixman_region32_init(&surface->input_region); pixman_region32_init(&surface->input_region);
wlr_addon_set_init(&surface->addons); wlr_addon_set_init(&surface->addons);
@ -1259,8 +1248,6 @@ void wlr_surface_get_effective_damage(struct wlr_surface *surface,
float scale_y = (float)surface->current.viewport.dst_height / src_height; float scale_y = (float)surface->current.viewport.dst_height / src_height;
wlr_region_scale_xy(damage, damage, scale_x, scale_y); wlr_region_scale_xy(damage, damage, scale_x, scale_y);
} }
pixman_region32_union(damage, damage, &surface->external_damage);
} }
void wlr_surface_get_buffer_source_box(struct wlr_surface *surface, void wlr_surface_get_buffer_source_box(struct wlr_surface *surface,

@ -118,8 +118,6 @@ static void subsurface_handle_place_above(struct wl_client *client,
wl_list_remove(&subsurface->pending.link); wl_list_remove(&subsurface->pending.link);
wl_list_insert(node, &subsurface->pending.link); wl_list_insert(node, &subsurface->pending.link);
subsurface->reordered = true;
} }
static void subsurface_handle_place_below(struct wl_client *client, static void subsurface_handle_place_below(struct wl_client *client,
@ -150,8 +148,6 @@ static void subsurface_handle_place_below(struct wl_client *client,
wl_list_remove(&subsurface->pending.link); wl_list_remove(&subsurface->pending.link);
wl_list_insert(node->prev, &subsurface->pending.link); wl_list_insert(node->prev, &subsurface->pending.link);
subsurface->reordered = true;
} }
static void subsurface_handle_set_sync(struct wl_client *client, static void subsurface_handle_set_sync(struct wl_client *client,
@ -281,37 +277,12 @@ static void subsurface_handle_surface_client_commit(
} }
} }
static void collect_damage_iter(struct wlr_surface *surface,
int sx, int sy, void *data) {
struct wlr_subsurface *subsurface = data;
pixman_region32_t *damage = &subsurface->parent->external_damage;
pixman_region32_union_rect(damage, damage,
subsurface->current.x + sx,
subsurface->current.y + sy,
surface->current.width, surface->current.height);
}
void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface) { void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface) {
struct wlr_surface *surface = subsurface->surface;
bool moved = subsurface->current.x != subsurface->previous.x ||
subsurface->current.y != subsurface->previous.y;
if (subsurface->surface->mapped && moved) {
wlr_surface_for_each_surface(surface,
collect_damage_iter, subsurface);
}
if (subsurface->synchronized && subsurface->has_cache) { if (subsurface->synchronized && subsurface->has_cache) {
wlr_surface_unlock_cached(surface, subsurface->cached_seq); wlr_surface_unlock_cached(subsurface->surface, subsurface->cached_seq);
subsurface->has_cache = false; subsurface->has_cache = false;
} }
if (subsurface->surface->mapped && (moved || subsurface->reordered)) {
subsurface->reordered = false;
wlr_surface_for_each_surface(surface,
collect_damage_iter, subsurface);
}
if (!subsurface->added) { if (!subsurface->added) {
subsurface->added = true; subsurface->added = true;
wl_signal_emit_mutable(&subsurface->parent->events.new_subsurface, wl_signal_emit_mutable(&subsurface->parent->events.new_subsurface,

Loading…
Cancel
Save