Commit f36fa53b authored by Jonas Ådahl's avatar Jonas Ådahl

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
parent 4f58a462
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment