Commit 5a67ef06 authored by Adrien Maglo's avatar Adrien Maglo Committed by Thomas Guillem

vout: opengl: transmit the window aspect ratio

Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent 2f4ae291
......@@ -389,6 +389,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
vout_display_place_t place;
vout_display_PlacePicture (&place, source, &cfg_tmp, false);
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
sys->place = place;
return VLC_SUCCESS;
......
......@@ -232,6 +232,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
vout_display_PlacePicture (&place, src, c, false);
vlc_gl_Resize (sys->gl, place.width, place.height);
vlc_gl_MakeCurrent (sys->gl);
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
glViewport (place.x, place.y, place.width, place.height);
vlc_gl_ReleaseCurrent (sys->gl);
return VLC_SUCCESS;
......@@ -246,6 +247,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
vout_display_PlacePicture (&place, src, cfg, false);
vlc_gl_MakeCurrent (sys->gl);
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
glViewport (place.x, place.y, place.width, place.height);
vlc_gl_ReleaseCurrent (sys->gl);
return VLC_SUCCESS;
......
......@@ -419,6 +419,8 @@ static int Control(vout_display_t *vd, int query, va_list ap)
sys->place = place;
}
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
// x / y are top left corner, but we need the lower left one
if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
glViewport(place.x, cfg_tmp.display.height - (place.y + place.height), place.width, place.height);
......
......@@ -421,6 +421,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
sys->place = place;
}
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
/* For resize, we call glViewport in reshape and not here.
This has the positive side effect that we avoid erratic sizing as we animate every resize. */
if (query != VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
......
......@@ -311,6 +311,7 @@ static void Manage (vout_display_t *vd)
const int width = sys->rect_dest.right - sys->rect_dest.left;
const int height = sys->rect_dest.bottom - sys->rect_dest.top;
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)width / height);
glViewport(0, 0, width, height);
}
......
......@@ -235,6 +235,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
vout_display_PlacePicture (&place, source, cfg, false);
vlc_gl_MakeCurrent (sys->gl);
vout_display_opengl_SetWindowAspectRatio(sys->vgl, (float)place.width / place.height);
glViewport (place.x, place.y, place.width, place.height);
vlc_gl_ReleaseCurrent (sys->gl);
return VLC_SUCCESS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment