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

@ -462,31 +462,20 @@ shell_util_composite_capture_images (ClutterCapture *captures,
int n_captures,
int x,
int y,
int width,
int height)
int target_width,
int target_height,
float target_scale)
{
int i;
double target_scale;
cairo_format_t format;
cairo_surface_t *image;
cairo_t *cr;
g_assert (n_captures > 0);
target_scale = 0.0;
for (i = 0; i < n_captures; i++)
{
ClutterCapture *capture = &captures[i];
double capture_scale = 1.0;
cairo_surface_get_device_scale (capture->image, &capture_scale, NULL);
target_scale = MAX (target_scale, capture_scale);
}
g_assert (target_scale > 0.0f);
format = cairo_image_surface_get_format (captures[0].image);
image = cairo_image_surface_create (format,
width * target_scale,
height * target_scale);
image = cairo_image_surface_create (format, target_width, target_height);
cairo_surface_set_device_scale (image, target_scale, target_scale);
cr = cairo_create (image);