Compare commits

...

2 Commits
5.7.1 ... 5.7.2

Author SHA1 Message Date
dec05eba
cb8104d107 5.7.2 2025-09-23 19:41:01 +02:00
dec05eba
7b64f10eaf x11: fix incorrect screen ratio in recording when recording the first monitor 2025-09-23 19:38:44 +02:00
4 changed files with 16 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
project('gpu-screen-recorder', ['c', 'cpp'], version : '5.7.1', default_options : ['warning_level=2'])
project('gpu-screen-recorder', ['c', 'cpp'], version : '5.7.2', default_options : ['warning_level=2'])
add_project_arguments('-Wshadow', language : ['c', 'cpp'])
if get_option('buildtype') == 'debug'

View File

@@ -1,7 +1,7 @@
[package]
name = "gpu-screen-recorder"
type = "executable"
version = "5.7.1"
version = "5.7.2"
platforms = ["posix"]
[config]

View File

@@ -622,7 +622,6 @@ static int gsr_capture_kms_capture(gsr_capture *cap, gsr_capture_metadata *captu
gsr_kms_set_hdr_metadata(self, drm_fd);
self->capture_size = rotate_capture_size_if_rotated(self, (vec2i){ drm_fd->crtc_w, drm_fd->crtc_h });
const vec2i original_frame_size = self->capture_size;
if(self->params.region_size.x > 0 && self->params.region_size.y > 0)
self->capture_size = self->params.region_size;
@@ -654,7 +653,7 @@ static int gsr_capture_kms_capture(gsr_capture *cap, gsr_capture_metadata *captu
gsr_color_conversion_draw(color_conversion, self->external_texture_fallback ? self->external_input_texture_id : self->input_texture_id,
target_pos, output_size,
capture_pos, self->capture_size, original_frame_size,
capture_pos, self->capture_size, (vec2i){ drm_fd->width, drm_fd->height },
gsr_monitor_rotation_to_rotation(rotation), GSR_SOURCE_COLOR_RGB, self->external_texture_fallback, false);
if(self->params.record_cursor) {

View File

@@ -476,7 +476,10 @@ static void gsr_color_conversion_swizzle_reset(gsr_color_conversion *self, gsr_s
}
}
static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsigned int texture_id, bool external_texture, float rotation_matrix[2][2], vec2i source_position, vec2i source_size, vec2i destination_pos, vec2i texture_size, vec2f scale, gsr_source_color source_color) {
static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsigned int texture_id, bool external_texture, gsr_rotation rotation, float rotation_matrix[2][2], vec2i source_position, vec2i source_size, vec2i destination_pos, vec2i texture_size, vec2f scale, gsr_source_color source_color) {
if(source_size.x == 0 || source_size.y == 0)
return;
const vec2i dest_texture_size = self->params.destination_textures_size[0];
const int texture_target = external_texture ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
@@ -498,11 +501,18 @@ static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsig
(float)source_position.y / (texture_size.y == 0 ? 1.0f : (float)texture_size.y),
};
const vec2f texture_size_norm = {
vec2f texture_size_norm = {
(float)source_size.x / (texture_size.x == 0 ? 1.0f : (float)texture_size.x),
(float)source_size.y / (texture_size.y == 0 ? 1.0f : (float)texture_size.y),
};
if(rotation == GSR_ROT_90 || rotation == GSR_ROT_270) {
const float ratio_x = (double)source_size.x / (double)source_size.y;
const float ratio_y = (double)source_size.y / (double)source_size.x;
texture_size_norm.x *= ratio_y;
texture_size_norm.y *= ratio_x;
}
const float vertices[] = {
-1.0f + 0.0f, -1.0f + 0.0f + size_norm.y, texture_pos_norm.x, texture_pos_norm.y + texture_size_norm.y,
-1.0f + 0.0f, -1.0f + 0.0f, texture_pos_norm.x, texture_pos_norm.y,
@@ -585,7 +595,7 @@ void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_
source_position.x += source_pos.x;
source_position.y += source_pos.y;
gsr_color_conversion_draw_graphics(self, texture_id, external_texture, rotation_matrix, source_position, source_size, destination_pos, texture_size, scale, source_color);
gsr_color_conversion_draw_graphics(self, texture_id, external_texture, rotation, rotation_matrix, source_position, source_size, destination_pos, texture_size, scale, source_color);
self->params.egl->glFlush();
// TODO: Use the minimal barrier required