mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
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>
This commit is contained in:
parent
a49dc78396
commit
64c9c9c5b0
@ -52,7 +52,9 @@ int64_t clutter_stage_get_frame_counter (ClutterStage *stage);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_capture_into (ClutterStage *stage,
|
void clutter_stage_capture_into (ClutterStage *stage,
|
||||||
cairo_rectangle_int_t *rect,
|
cairo_rectangle_int_t *rect,
|
||||||
uint8_t *data);
|
float scale,
|
||||||
|
uint8_t *data,
|
||||||
|
int stride);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_capture_view_into (ClutterStage *stage,
|
void clutter_stage_capture_view_into (ClutterStage *stage,
|
||||||
|
@ -3272,14 +3272,13 @@ clutter_stage_capture_view_into (ClutterStage *stage,
|
|||||||
void
|
void
|
||||||
clutter_stage_capture_into (ClutterStage *stage,
|
clutter_stage_capture_into (ClutterStage *stage,
|
||||||
cairo_rectangle_int_t *rect,
|
cairo_rectangle_int_t *rect,
|
||||||
uint8_t *data)
|
float scale,
|
||||||
|
uint8_t *data,
|
||||||
|
int stride)
|
||||||
{
|
{
|
||||||
ClutterStagePrivate *priv = stage->priv;
|
ClutterStagePrivate *priv = stage->priv;
|
||||||
GList *l;
|
GList *l;
|
||||||
int bpp = 4;
|
int bpp = 4;
|
||||||
int stride;
|
|
||||||
|
|
||||||
stride = rect->width * 4;
|
|
||||||
|
|
||||||
for (l = _clutter_stage_window_get_views (priv->impl); l; l = l->next)
|
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_get_extents (region, &capture_rect);
|
||||||
cairo_region_destroy (region);
|
cairo_region_destroy (region);
|
||||||
|
|
||||||
x_offset = capture_rect.x - rect->x;
|
x_offset = roundf ((capture_rect.x - rect->x) * scale);
|
||||||
y_offset = capture_rect.y - rect->y;
|
y_offset = roundf ((capture_rect.y - rect->y) * scale);
|
||||||
|
|
||||||
clutter_stage_capture_view_into (stage, view,
|
clutter_stage_capture_view_into (stage, view,
|
||||||
&capture_rect,
|
&capture_rect,
|
||||||
|
@ -528,11 +528,18 @@ meta_screen_cast_monitor_stream_src_record_to_buffer (MetaScreenCastStreamSrc *
|
|||||||
ClutterStage *stage;
|
ClutterStage *stage;
|
||||||
MetaMonitor *monitor;
|
MetaMonitor *monitor;
|
||||||
MetaLogicalMonitor *logical_monitor;
|
MetaLogicalMonitor *logical_monitor;
|
||||||
|
float scale;
|
||||||
|
|
||||||
monitor = get_monitor (monitor_src);
|
monitor = get_monitor (monitor_src);
|
||||||
logical_monitor = meta_monitor_get_logical_monitor (monitor);
|
logical_monitor = meta_monitor_get_logical_monitor (monitor);
|
||||||
stage = get_stage (monitor_src);
|
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))
|
switch (meta_screen_cast_stream_get_cursor_mode (stream))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user