mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 09:07:13 +09:00
Kms: fix region capture incorrect when monitor is rotated
This commit is contained in:
2
TODO
2
TODO
@@ -348,3 +348,5 @@ Add option to save screenshot as .qoi. Use that then in gsr-ui for the backgroun
|
|||||||
Support pausing recording when recording while replay/streaming.
|
Support pausing recording when recording while replay/streaming.
|
||||||
|
|
||||||
Maybe use VK_VALVE_video_encode_rgb_conversion with vulkan encoding for shader-less rgb to yuv conversion. That would allow screen capture with no gpu processing.
|
Maybe use VK_VALVE_video_encode_rgb_conversion with vulkan encoding for shader-less rgb to yuv conversion. That would allow screen capture with no gpu processing.
|
||||||
|
|
||||||
|
Cursor sometimes doesn't have color when capturing region scaled (on kde plasma wayland at least).
|
||||||
@@ -483,6 +483,12 @@ static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsig
|
|||||||
const vec2i dest_texture_size = self->params.destination_textures_size[0];
|
const vec2i dest_texture_size = self->params.destination_textures_size[0];
|
||||||
const int texture_target = external_texture ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
|
const int texture_target = external_texture ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
|
||||||
|
|
||||||
|
if(rotation == GSR_ROT_90 || rotation == GSR_ROT_270) {
|
||||||
|
const float tmp = texture_size.x;
|
||||||
|
texture_size.x = texture_size.y;
|
||||||
|
texture_size.y = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
self->params.egl->glBindTexture(texture_target, texture_id);
|
self->params.egl->glBindTexture(texture_target, texture_id);
|
||||||
gsr_color_conversion_swizzle_texture_source(self, source_color);
|
gsr_color_conversion_swizzle_texture_source(self, source_color);
|
||||||
|
|
||||||
@@ -501,18 +507,11 @@ 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),
|
(float)source_position.y / (texture_size.y == 0 ? 1.0f : (float)texture_size.y),
|
||||||
};
|
};
|
||||||
|
|
||||||
vec2f texture_size_norm = {
|
const vec2f texture_size_norm = {
|
||||||
(float)source_size.x / (texture_size.x == 0 ? 1.0f : (float)texture_size.x),
|
(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),
|
(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[] = {
|
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 + 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,
|
-1.0f + 0.0f, -1.0f + 0.0f, texture_pos_norm.x, texture_pos_norm.y,
|
||||||
|
|||||||
Reference in New Issue
Block a user