mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
clutter: Expose 'capture_view_into()` as API
It'll be used to explicitly capture the content of a single view. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
parent
005c49063d
commit
9b1b4eb843
@ -54,6 +54,13 @@ void clutter_stage_capture_into (ClutterStage *stage,
|
|||||||
cairo_rectangle_int_t *rect,
|
cairo_rectangle_int_t *rect,
|
||||||
uint8_t *data);
|
uint8_t *data);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_stage_capture_view_into (ClutterStage *stage,
|
||||||
|
ClutterStageView *view,
|
||||||
|
cairo_rectangle_int_t *rect,
|
||||||
|
uint8_t *data,
|
||||||
|
int stride);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_clear_stage_views (ClutterStage *stage);
|
void clutter_stage_clear_stage_views (ClutterStage *stage);
|
||||||
|
|
||||||
|
@ -175,11 +175,6 @@ static const ClutterColor default_stage_color = { 255, 255, 255, 255 };
|
|||||||
|
|
||||||
static void free_queue_redraw_entry (QueueRedrawEntry *entry);
|
static void free_queue_redraw_entry (QueueRedrawEntry *entry);
|
||||||
static void free_pointer_device_entry (PointerDeviceEntry *entry);
|
static void free_pointer_device_entry (PointerDeviceEntry *entry);
|
||||||
static void capture_view_into (ClutterStage *stage,
|
|
||||||
ClutterStageView *view,
|
|
||||||
cairo_rectangle_int_t *rect,
|
|
||||||
uint8_t *data,
|
|
||||||
int stride);
|
|
||||||
static void clutter_stage_update_view_perspective (ClutterStage *stage);
|
static void clutter_stage_update_view_perspective (ClutterStage *stage);
|
||||||
static void clutter_stage_set_viewport (ClutterStage *stage,
|
static void clutter_stage_set_viewport (ClutterStage *stage,
|
||||||
float width,
|
float width,
|
||||||
@ -3227,12 +3222,12 @@ clutter_stage_paint_to_buffer (ClutterStage *stage,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
capture_view_into (ClutterStage *stage,
|
clutter_stage_capture_view_into (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
cairo_rectangle_int_t *rect,
|
cairo_rectangle_int_t *rect,
|
||||||
uint8_t *data,
|
uint8_t *data,
|
||||||
int stride)
|
int stride)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
@ -3247,6 +3242,11 @@ capture_view_into (ClutterStage *stage,
|
|||||||
|
|
||||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||||
|
|
||||||
|
clutter_stage_view_get_layout (view, &view_layout);
|
||||||
|
|
||||||
|
if (!rect)
|
||||||
|
rect = &view_layout;
|
||||||
|
|
||||||
view_scale = clutter_stage_view_get_scale (view);
|
view_scale = clutter_stage_view_get_scale (view);
|
||||||
texture_width = roundf (rect->width * view_scale);
|
texture_width = roundf (rect->width * view_scale);
|
||||||
texture_height = roundf (rect->height * view_scale);
|
texture_height = roundf (rect->height * view_scale);
|
||||||
@ -3259,8 +3259,6 @@ capture_view_into (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,
|
||||||
roundf ((rect->x - view_layout.x) * view_scale),
|
roundf ((rect->x - view_layout.x) * view_scale),
|
||||||
roundf ((rect->y - view_layout.y) * view_scale),
|
roundf ((rect->y - view_layout.y) * view_scale),
|
||||||
@ -3300,10 +3298,12 @@ clutter_stage_capture_into (ClutterStage *stage,
|
|||||||
x_offset = capture_rect.x - rect->x;
|
x_offset = capture_rect.x - rect->x;
|
||||||
y_offset = capture_rect.y - rect->y;
|
y_offset = capture_rect.y - rect->y;
|
||||||
|
|
||||||
capture_view_into (stage, view,
|
clutter_stage_capture_view_into (stage, view,
|
||||||
&capture_rect,
|
&capture_rect,
|
||||||
data + (x_offset * bpp) + (y_offset * stride),
|
(data +
|
||||||
stride);
|
(x_offset * bpp) +
|
||||||
|
(y_offset * stride)),
|
||||||
|
stride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user