screenshooter: Grab pixel data directly before buffer swap
[profile/ivi/weston-ivi-shell.git] / src / compositor-x11.c
index b910831..6d9bb0e 100644 (file)
@@ -212,6 +212,8 @@ x11_output_repaint(struct weston_output *output_base,
        wl_list_for_each_reverse(surface, &compositor->base.surface_list, link)
                weston_surface_draw(surface, &output->base, damage);
 
+       weston_output_do_read_pixels(&output->base);
+
        eglSwapBuffers(compositor->base.display, output->egl_surface);
 
        wl_event_source_timer_update(output->finish_frame_timer, 10);
@@ -344,21 +346,6 @@ x11_output_set_icon(struct x11_compositor *c,
        pixman_image_unref(image);
 }
 
-static void
-x11_output_read_pixels(struct weston_output *output_base, void *data)
-{
-       struct x11_output *output = (struct x11_output *) output_base;
-       struct x11_compositor *compositor =
-               (struct x11_compositor *) output->base.compositor;
-
-       eglMakeCurrent(compositor->base.display, output->egl_surface,
-                       output->egl_surface, compositor->base.context);
-
-       glReadPixels(0, 0, output_base->current->width,
-                    output_base->current->height,
-                    compositor->base.read_format, GL_UNSIGNED_BYTE, data);
-}
-
 static int
 x11_compositor_create_output(struct x11_compositor *c, int x, int y,
                             int width, int height, int fullscreen)
@@ -470,7 +457,6 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y,
        output->base.repaint = x11_output_repaint;
        output->base.destroy = x11_output_destroy;
        output->base.assign_planes = NULL;
-       output->base.read_pixels = x11_output_read_pixels;
        output->base.set_backlight = NULL;
        output->base.set_dpms = NULL;
        output->base.switch_mode = NULL;