+screenshooter_read_pixels_done(struct weston_read_pixels *base,
+ struct weston_output *output)
+{
+ struct screenshooter_read_pixels *r =
+ (struct screenshooter_read_pixels *) base;
+ int32_t buffer_stride, output_stride;
+ uint8_t *d, *s;
+
+ buffer_stride = wl_shm_buffer_get_stride(r->buffer);
+ output_stride = output->current->width * 4;
+
+ d = wl_shm_buffer_get_data(r->buffer) +
+ output->y * buffer_stride + output->x * 4;
+ s = r->base.data + output_stride * (output->current->height - 1);
+
+ switch (output->compositor->read_format) {
+ case GL_BGRA_EXT:
+ copy_bgra_yflip(d, s, output->current->height,
+ buffer_stride, output_stride);
+ break;
+ case GL_RGBA:
+ copy_rgba_yflip(d, s, output->current->height,
+ buffer_stride, output_stride);
+ break;
+ default:
+ break;
+ }
+
+ wl_list_remove(&r->base.link);
+
+ screenshooter_send_done(r->resource);
+ free(r->base.data);
+ free(r);
+
+}
+
+static void