From f36fa53b0e8b7e2389ea2b63516a2eb00fcc7aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 19 Aug 2016 10:45:08 +0800 Subject: [PATCH] clutter/stage: Offset framebuffer capture origin by view layout The rectangle passed to capture_view() is in stage coordinate space; thus, to translate to framebuffer coordinate space, the origin need to be translated by the view layout position. This fixes capturing views not at position (0, 0). https://bugzilla.gnome.org/show_bug.cgi?id=770127 --- clutter/clutter/clutter-stage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index edbc9b4dc..85cb343eb 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -4676,6 +4676,7 @@ capture_view (ClutterStage *stage, uint8_t *data; int stride; CoglBitmap *bitmap; + cairo_rectangle_int_t view_layout; framebuffer = clutter_stage_view_get_framebuffer (view); @@ -4700,8 +4701,11 @@ capture_view (ClutterStage *stage, stride, data); + clutter_stage_view_get_layout (view, &view_layout); + cogl_framebuffer_read_pixels_into_bitmap (framebuffer, - rect->x, rect->y, + view_layout.x - rect->x, + view_layout.y - rect->y, COGL_READ_PIXELS_COLOR_BUFFER, bitmap);