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,
|
||||
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
|
||||
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_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_set_viewport (ClutterStage *stage,
|
||||
float width,
|
||||
@ -3227,8 +3222,8 @@ clutter_stage_paint_to_buffer (ClutterStage *stage,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
capture_view_into (ClutterStage *stage,
|
||||
void
|
||||
clutter_stage_capture_view_into (ClutterStage *stage,
|
||||
ClutterStageView *view,
|
||||
cairo_rectangle_int_t *rect,
|
||||
uint8_t *data,
|
||||
@ -3247,6 +3242,11 @@ capture_view_into (ClutterStage *stage,
|
||||
|
||||
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);
|
||||
texture_width = roundf (rect->width * view_scale);
|
||||
texture_height = roundf (rect->height * view_scale);
|
||||
@ -3259,8 +3259,6 @@ capture_view_into (ClutterStage *stage,
|
||||
stride,
|
||||
data);
|
||||
|
||||
clutter_stage_view_get_layout (view, &view_layout);
|
||||
|
||||
cogl_framebuffer_read_pixels_into_bitmap (framebuffer,
|
||||
roundf ((rect->x - view_layout.x) * view_scale),
|
||||
roundf ((rect->y - view_layout.y) * view_scale),
|
||||
@ -3300,9 +3298,11 @@ clutter_stage_capture_into (ClutterStage *stage,
|
||||
x_offset = capture_rect.x - rect->x;
|
||||
y_offset = capture_rect.y - rect->y;
|
||||
|
||||
capture_view_into (stage, view,
|
||||
clutter_stage_capture_view_into (stage, view,
|
||||
&capture_rect,
|
||||
data + (x_offset * bpp) + (y_offset * stride),
|
||||
(data +
|
||||
(x_offset * bpp) +
|
||||
(y_offset * stride)),
|
||||
stride);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user