pipewire: Properly pass sizes to gs_draw_sprite_subregion
The gs_draw_sprite_subregion() function is used when a cropping rectangle is received from PipeWire. It is usually used by compositors to implement window screencast - where a large and mostly empty frame is sent, the window contents are only a small part of it, and the crop rectangle tells us that. Recently the wlroots implementation of portals started to use it to implement cropping, and it exposed a bug in the PipeWire code in OBS Studio. The gs_draw_sprite_subregion() function takes a pair of integers representing position (x, y) and a pair of integers representing size (width, height). The PipeWire code, however, passes a second pair of positions (x2, y2) instead of sizes, and it causes overrendering the crop area. This bug wasn't hit yet because both GNOME and KDE implementations always send (0, 0) as position, which practically never trigger this condition. Pass only width and height to gs_draw_sprite_subregion(), instead of adding x and y to them. Fixes https://github.com/obsproject/obs-studio/issues/4982
This commit is contained in:
parent
4d9d7b7070
commit
ec3e8146b2
@ -1200,9 +1200,8 @@ void obs_pipewire_video_render(obs_pipewire_data *obs_pw, gs_effect_t *effect)
|
||||
|
||||
if (has_effective_crop(obs_pw)) {
|
||||
gs_draw_sprite_subregion(obs_pw->texture, 0, obs_pw->crop.x,
|
||||
obs_pw->crop.y,
|
||||
obs_pw->crop.x + obs_pw->crop.width,
|
||||
obs_pw->crop.y + obs_pw->crop.height);
|
||||
obs_pw->crop.y, obs_pw->crop.width,
|
||||
obs_pw->crop.height);
|
||||
} else {
|
||||
gs_draw_sprite(obs_pw->texture, 0, 0, 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user