[mutter/gnome-40] Revert "clutter/stage: Remove clutter_stage_capture_into"
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-40] Revert "clutter/stage: Remove clutter_stage_capture_into"
- Date: Tue, 21 Sep 2021 15:21:13 +0000 (UTC)
commit 5526e369e7e5f75394cc65ce061c3cc2188ee037
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Sep 21 17:21:03 2021 +0200
Revert "clutter/stage: Remove clutter_stage_capture_into"
This reverts commit 8de09c7becb13cb28c74063c3a4af773a5607483.
clutter/clutter/clutter-mutter.h | 7 +++++++
clutter/clutter/clutter-stage.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
---
diff --git a/clutter/clutter/clutter-mutter.h b/clutter/clutter/clutter-mutter.h
index 82c6ebc484..91e1535862 100644
--- a/clutter/clutter/clutter-mutter.h
+++ b/clutter/clutter/clutter-mutter.h
@@ -49,6 +49,13 @@ void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
CLUTTER_EXPORT
int64_t clutter_stage_get_frame_counter (ClutterStage *stage);
+CLUTTER_EXPORT
+void clutter_stage_capture_into (ClutterStage *stage,
+ cairo_rectangle_int_t *rect,
+ float scale,
+ uint8_t *data,
+ int stride);
+
CLUTTER_EXPORT
void clutter_stage_capture_view_into (ClutterStage *stage,
ClutterStageView *view,
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 7b4c420a3c..8627c6a17f 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3269,6 +3269,44 @@ clutter_stage_capture_view_into (ClutterStage *stage,
cogl_object_unref (bitmap);
}
+void
+clutter_stage_capture_into (ClutterStage *stage,
+ cairo_rectangle_int_t *rect,
+ float scale,
+ uint8_t *data,
+ int stride)
+{
+ ClutterStagePrivate *priv = stage->priv;
+ GList *l;
+ int bpp = 4;
+
+ for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
+ {
+ ClutterStageView *view = l->data;
+ cairo_rectangle_int_t view_layout;
+ cairo_region_t *region;
+ cairo_rectangle_int_t capture_rect;
+ int x_offset, y_offset;
+
+ clutter_stage_view_get_layout (view, &view_layout);
+ region = cairo_region_create_rectangle (&view_layout);
+ cairo_region_intersect_rectangle (region, rect);
+
+ cairo_region_get_extents (region, &capture_rect);
+ cairo_region_destroy (region);
+
+ x_offset = roundf ((capture_rect.x - rect->x) * scale);
+ y_offset = roundf ((capture_rect.y - rect->y) * scale);
+
+ clutter_stage_capture_view_into (stage, view,
+ &capture_rect,
+ (data +
+ (x_offset * bpp) +
+ (y_offset * stride)),
+ stride);
+ }
+}
+
/**
* clutter_stage_peek_stage_views: (skip)
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]