From 70fced3889b4c15044041b960ab9d6be9b697f5e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 8 Nov 2024 20:52:08 +0100 Subject: x11: fix correct monitor capture size when output is scaled --- src/capture/kms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/capture/kms.c') diff --git a/src/capture/kms.c b/src/capture/kms.c index 829fc6a..5292012 100644 --- a/src/capture/kms.c +++ b/src/capture/kms.c @@ -582,13 +582,14 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c " If you are experience performance problems in the video then record a single window on X11 or use portal capture option instead\n"); } + self->capture_size = rotate_capture_size_if_rotated(self, (vec2i){ drm_fd->src_w, drm_fd->src_h }); + const bool is_scaled = self->params.output_resolution.x > 0 && self->params.output_resolution.y > 0; vec2i output_size = is_scaled ? self->params.output_resolution : self->capture_size; output_size = scale_keep_aspect_ratio(self->capture_size, output_size); const float texture_rotation = monitor_rotation_to_radians(self->monitor_rotation); const vec2i target_pos = { max_int(0, frame->width / 2 - output_size.x / 2), max_int(0, frame->height / 2 - output_size.y / 2) }; - self->capture_size = rotate_capture_size_if_rotated(self, (vec2i){ drm_fd->src_w, drm_fd->src_h }); gsr_capture_kms_update_capture_size_change(self, color_conversion, target_pos, drm_fd); vec2i capture_pos = self->capture_pos; -- cgit v1.2.3