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
This commit is contained in:
parent
4f58a46217
commit
f36fa53b0e
@ -4676,6 +4676,7 @@ capture_view (ClutterStage *stage,
|
|||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
int stride;
|
int stride;
|
||||||
CoglBitmap *bitmap;
|
CoglBitmap *bitmap;
|
||||||
|
cairo_rectangle_int_t view_layout;
|
||||||
|
|
||||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||||
|
|
||||||
@ -4700,8 +4701,11 @@ capture_view (ClutterStage *stage,
|
|||||||
stride,
|
stride,
|
||||||
data);
|
data);
|
||||||
|
|
||||||
|
clutter_stage_view_get_layout (view, &view_layout);
|
||||||
|
|
||||||
cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
|
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,
|
COGL_READ_PIXELS_COLOR_BUFFER,
|
||||||
bitmap);
|
bitmap);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user