[mutter] clutter: Make stage capture support fractional scaling
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter: Make stage capture support fractional scaling
- Date: Tue, 11 May 2021 15:19:35 +0000 (UTC)
commit 64c9c9c5b005cf17103d8e1e0a08dec0b1094267
Author: kirbykevinson <kirbykevinson outlook com>
Date: Sat May 8 18:22:27 2021 +0700
clutter: Make stage capture support fractional scaling
This commit adds scaling support to clutter_stage_capture_into, which
is currently used when screencasting monitors. This is supposed to
fix graphical issues that arise when using fractional scaling.
Fixes #1131
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1855>
clutter/clutter/clutter-mutter.h | 4 +++-
clutter/clutter/clutter-stage.c | 11 +++++------
src/backends/meta-screen-cast-monitor-stream-src.c | 9 ++++++++-
3 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/clutter/clutter/clutter-mutter.h b/clutter/clutter/clutter-mutter.h
index 88dee26587..91e1535862 100644
--- a/clutter/clutter/clutter-mutter.h
+++ b/clutter/clutter/clutter-mutter.h
@@ -52,7 +52,9 @@ int64_t clutter_stage_get_frame_counter (ClutterStage *stage);
CLUTTER_EXPORT
void clutter_stage_capture_into (ClutterStage *stage,
cairo_rectangle_int_t *rect,
- uint8_t *data);
+ float scale,
+ uint8_t *data,
+ int stride);
CLUTTER_EXPORT
void clutter_stage_capture_view_into (ClutterStage *stage,
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index 95e42e8589..8627c6a17f 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -3272,14 +3272,13 @@ clutter_stage_capture_view_into (ClutterStage *stage,
void
clutter_stage_capture_into (ClutterStage *stage,
cairo_rectangle_int_t *rect,
- uint8_t *data)
+ float scale,
+ uint8_t *data,
+ int stride)
{
ClutterStagePrivate *priv = stage->priv;
GList *l;
int bpp = 4;
- int stride;
-
- stride = rect->width * 4;
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
{
@@ -3296,8 +3295,8 @@ clutter_stage_capture_into (ClutterStage *stage,
cairo_region_get_extents (region, &capture_rect);
cairo_region_destroy (region);
- x_offset = capture_rect.x - rect->x;
- y_offset = capture_rect.y - rect->y;
+ 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,
diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c
b/src/backends/meta-screen-cast-monitor-stream-src.c
index 008cd6de70..b85c44fe12 100644
--- a/src/backends/meta-screen-cast-monitor-stream-src.c
+++ b/src/backends/meta-screen-cast-monitor-stream-src.c
@@ -528,11 +528,18 @@ meta_screen_cast_monitor_stream_src_record_to_buffer (MetaScreenCastStreamSrc *
ClutterStage *stage;
MetaMonitor *monitor;
MetaLogicalMonitor *logical_monitor;
+ float scale;
monitor = get_monitor (monitor_src);
logical_monitor = meta_monitor_get_logical_monitor (monitor);
stage = get_stage (monitor_src);
- clutter_stage_capture_into (stage, &logical_monitor->rect, data);
+
+ if (meta_is_stage_views_scaled ())
+ scale = meta_logical_monitor_get_scale (logical_monitor);
+ else
+ scale = 1.0;
+
+ clutter_stage_capture_into (stage, &logical_monitor->rect, scale, data, stride);
switch (meta_screen_cast_stream_get_cursor_mode (stream))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]