|
|
|
@ -206,8 +206,13 @@ static void surface_commit(struct wl_client *client,
|
|
|
|
|
surface->current.buffer = surface->pending.buffer;
|
|
|
|
|
}
|
|
|
|
|
if ((surface->pending.invalid & WLR_SURFACE_INVALID_SURFACE_DAMAGE)) {
|
|
|
|
|
int32_t oldw = surface->current.buffer_width;
|
|
|
|
|
int32_t oldh = surface->current.buffer_height;
|
|
|
|
|
wlr_surface_update_size(surface);
|
|
|
|
|
|
|
|
|
|
surface->reupload_buffer = oldw != surface->current.buffer_width ||
|
|
|
|
|
oldh != surface->current.buffer_height;
|
|
|
|
|
|
|
|
|
|
pixman_region32_union(&surface->current.surface_damage,
|
|
|
|
|
&surface->current.surface_damage,
|
|
|
|
|
&surface->pending.surface_damage);
|
|
|
|
@ -257,13 +262,17 @@ void wlr_surface_flush_damage(struct wlr_surface *surface) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t format = wl_shm_buffer_get_format(buffer);
|
|
|
|
|
if (surface->reupload_buffer) {
|
|
|
|
|
wlr_texture_upload_shm(surface->texture, format, buffer);
|
|
|
|
|
} else {
|
|
|
|
|
pixman_region32_t damage = surface->current.buffer_damage;
|
|
|
|
|
if (!pixman_region32_not_empty(&damage)) {
|
|
|
|
|
goto release;
|
|
|
|
|
}
|
|
|
|
|
int n;
|
|
|
|
|
pixman_box32_t *rects = pixman_region32_rectangles(&damage, &n);
|
|
|
|
|
uint32_t format = wl_shm_buffer_get_format(buffer);
|
|
|
|
|
for (int i = 0; i < n; ++i) {
|
|
|
|
|
pixman_box32_t rect = rects[i];
|
|
|
|
|
if (!wlr_texture_update_shm(surface->texture, format,
|
|
|
|
@ -274,12 +283,15 @@ void wlr_surface_flush_damage(struct wlr_surface *surface) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
release:
|
|
|
|
|
pixman_region32_fini(&surface->current.surface_damage);
|
|
|
|
|
pixman_region32_init(&surface->current.surface_damage);
|
|
|
|
|
|
|
|
|
|
pixman_region32_fini(&surface->current.buffer_damage);
|
|
|
|
|
pixman_region32_init(&surface->current.buffer_damage);
|
|
|
|
|
release:
|
|
|
|
|
|
|
|
|
|
wl_resource_queue_event(surface->current.buffer, WL_BUFFER_RELEASE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|