[vlc-commits] opengl: display: flip configuration before applying it

Alexandre Janniaux git at videolan.org
Fri Jan 29 11:06:20 UTC 2021


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Tue Jan 26 18:59:37 2021 +0100| [dd3396d1e29eb9e357707337f782b99d4ee5dfba] | committer: Alexandre Janniaux

opengl: display: flip configuration before applying it

This was done everywhere except at the initialization.

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

 modules/video_output/opengl/display.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index c62ab37298..d95ce8fb6e 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -97,6 +97,16 @@ static const struct vlc_display_operations ops = {
     Close, PictureRender, PictureDisplay, Control, NULL, SetViewpoint,
 };
 
+static void
+FlipVerticalAlign(vout_display_cfg_t *cfg)
+{
+    /* Reverse vertical alignment as the GL tex are Y inverted */
+    if (cfg->align.vertical == VLC_VIDEO_ALIGN_TOP)
+        cfg->align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
+    else if (cfg->align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
+        cfg->align.vertical = VLC_VIDEO_ALIGN_TOP;
+}
+
 /**
  * Allocates a surface and an OpenGL context for video output.
  */
@@ -143,7 +153,10 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if (sys->gl == NULL)
         goto error;
 
-    vout_display_PlacePicture(&sys->place, vd->source, cfg);
+
+    vout_display_cfg_t flipped_cfg = *cfg;
+    FlipVerticalAlign(&flipped_cfg);
+    vout_display_PlacePicture(&sys->place, vd->source, &flipped_cfg);
     sys->place_changed = true;
     vlc_gl_Resize (sys->gl, cfg->display.width, cfg->display.height);
 
@@ -222,16 +235,6 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic)
     }
 }
 
-static void
-FlipVerticalAlign(vout_display_cfg_t *cfg)
-{
-    /* Reverse vertical alignment as the GL tex are Y inverted */
-    if (cfg->align.vertical == VLC_VIDEO_ALIGN_TOP)
-        cfg->align.vertical = VLC_VIDEO_ALIGN_BOTTOM;
-    else if (cfg->align.vertical == VLC_VIDEO_ALIGN_BOTTOM)
-        cfg->align.vertical = VLC_VIDEO_ALIGN_TOP;
-}
-
 static int Control (vout_display_t *vd, int query)
 {
     vout_display_sys_t *sys = vd->sys;



More information about the vlc-commits mailing list