[vlc-devel] [PATCH 15/18] opengl: correct vertical alignment

Victorien Le Couviour--Tuffet victorien.lecouviour.tuffet at gmail.com
Fri Aug 4 19:41:09 CEST 2017


The GL textures are Y inverted, so we must reverse the vertical alignment. As
this value can be 3 or 4, a xor 7 will automatically swap it.
---
 modules/video_output/opengl/display.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index a51c75734d..5ef0d8ea01 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -219,11 +219,17 @@ static int Control (vout_display_t *vd, int query, va_list ap)
       case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
       case VOUT_DISPLAY_CHANGE_ZOOM:
       {
-        const vout_display_cfg_t *c = va_arg (ap, const vout_display_cfg_t *);
+        vout_display_cfg_t c = *va_arg (ap, const vout_display_cfg_t *);
         const video_format_t *src = &vd->source;
         vout_display_place_t place;
 
-        vout_display_PlacePicture (&place, src, c, false);
+        /* Reverse vertical alignment as the GL tex are Y inverted */
+        if (c.align.vertical == VOUT_DISPLAY_ALIGN_TOP)
+            c.align.vertical = VOUT_DISPLAY_ALIGN_BOTTOM;
+        else if (c.align.vertical == VOUT_DISPLAY_ALIGN_BOTTOM)
+            c.align.vertical = VOUT_DISPLAY_ALIGN_TOP;
+
+        vout_display_PlacePicture (&place, src, &c, false);
         vlc_gl_Resize (sys->gl, place.width, place.height);
         if (vlc_gl_MakeCurrent (sys->gl) != VLC_SUCCESS)
             return VLC_EGENERIC;
-- 
2.13.1



More information about the vlc-devel mailing list