[vlc-commits] opengl: correct vertical alignment

Victorien Le Couviour--Tuffet git at videolan.org
Mon Aug 7 18:04:05 CEST 2017


vlc | branch: master | Victorien Le Couviour--Tuffet <victorien.lecouviour.tuffet at gmail.com> | Fri Aug  4 19:41:09 2017 +0200| [d6d8374d641a298e7db214ab8ac8956d102f553a] | committer: Jean-Baptiste Kempf

opengl: correct vertical alignment

The GL textures are Y inverted, so we must reverse the vertical alignment.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d6d8374d641a298e7db214ab8ac8956d102f553a
---

 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 2288987469..d12d6ca71a 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -213,11 +213,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;



More information about the vlc-commits mailing list