0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00

obs-transitions: skip stinger size factors if track matte is disabled

This commit is contained in:
Stéphane Lepin 2020-02-25 20:22:31 +01:00 committed by jp9000
parent 442ebce361
commit 2bd0404c17

View File

@ -89,20 +89,12 @@ static void stinger_update(void *data, obs_data_t *settings)
s->track_matte_enabled =
obs_data_get_bool(settings, "track_matte_enabled");
s->matte_layout = obs_data_get_int(settings, "track_matte_layout");
s->matte_width_factor =
(s->matte_layout == MATTE_LAYOUT_HORIZONTAL ? 2.0f : 1.0f);
s->matte_height_factor =
(s->matte_layout == MATTE_LAYOUT_VERTICAL ? 2.0f : 1.0f);
s->invert_matte = obs_data_get_bool(settings, "invert_matte");
s->matte_width_factor = 1.0f;
s->matte_height_factor = 1.0f;
if (s->track_matte_enabled) {
if (s->matte_layout == MATTE_LAYOUT_HORIZONTAL) {
s->matte_width_factor = 2.0f;
}
if (s->matte_layout == MATTE_LAYOUT_VERTICAL) {
s->matte_height_factor = 2.0f;
}
}
if (s->matte_source) {
obs_source_release(s->matte_source);
s->matte_source = NULL;
@ -286,8 +278,15 @@ static void stinger_video_render(void *data, gs_effect_t *effect)
if (!media_cx || !media_cy)
return;
float scale_x = source_cx / ((float)media_cx / s->matte_width_factor);
float scale_y = source_cy / ((float)media_cy / s->matte_height_factor);
float scale_x, scale_y;
if (s->track_matte_enabled) {
scale_x = source_cx / ((float)media_cx / s->matte_width_factor);
scale_y =
source_cy / ((float)media_cy / s->matte_height_factor);
} else {
scale_x = source_cx / (float)media_cx;
scale_y = source_cy / (float)media_cy;
}
gs_matrix_push();
gs_matrix_scale3f(scale_x, scale_y, 1.0f);