shell-recorder: Use clutter-computed sizes and scaling for the capture

Get from clutter the capture sizes and scale and don't mind
about doing any rounding here, as it might be different
from the one done at clutter level (causing mismatch and
not-working videos). Delegate this to clutter, and forget
about the internal details.

These values are then used to composte the image and set the video caps.

https://bugzilla.gnome.org/show_bug.cgi?id=7650111
This commit is contained in:
Marco Trevisan (Treviño)
2017-12-23 04:54:48 +01:00
committed by Jonas Ådahl
parent 4a4f752459
commit 6d6c2e5b99
4 changed files with 52 additions and 43 deletions

View File

@ -222,29 +222,32 @@ do_grab_screenshot (ShellScreenshot *screenshot,
int height)
{
ShellScreenshotPrivate *priv = screenshot->priv;
cairo_rectangle_int_t screenshot_rect = { x, y, width, height };
ClutterCapture *captures;
int n_captures;
int i;
clutter_stage_capture (stage, FALSE,
&(cairo_rectangle_int_t) {
.x = x,
.y = y,
.width = width,
.height = height
},
&captures,
&n_captures);
if (n_captures == 0)
if (!clutter_stage_capture (stage, FALSE,
&screenshot_rect,
&captures,
&n_captures))
return;
else if (n_captures == 1)
if (n_captures == 1)
priv->image = cairo_surface_reference (captures[0].image);
else
priv->image = shell_util_composite_capture_images (captures,
n_captures,
x, y,
width, height);
{
float target_scale;
clutter_stage_get_capture_final_size (stage, &screenshot_rect,
&width, &height, &target_scale);
priv->image = shell_util_composite_capture_images (captures,
n_captures,
x, y,
width, height,
target_scale);
}
priv->datetime = g_date_time_new_now_local ();
for (i = 0; i < n_captures; i++)