[MPlayer-dev-eng] [PATCH] kva: support -geometry option

KO Myung-Hun komh78 at gmail.com
Mon Mar 1 13:39:40 EET 2021


---
 libvo/vo_kva.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/libvo/vo_kva.c b/libvo/vo_kva.c
index 04333c64f..42b273dd7 100644
--- a/libvo/vo_kva.c
+++ b/libvo/vo_kva.c
@@ -812,12 +812,21 @@ static int config(uint32_t width, uint32_t height,
             d_height++;
         }
 
-        m_int.rclDst.xLeft   = ((LONG)vo_screenwidth  - (LONG)d_width)  / 2;
-        m_int.rclDst.yBottom = ((LONG)vo_screenheight - (LONG)d_height) / 2;
+        vo_dx = (vo_screenwidth - d_width) / 2;
+        vo_dy = (vo_screenheight - d_height ) / 2;
+        geometry(&vo_dx, &vo_dy, &d_width, &d_height,
+                 vo_screenwidth, vo_screenheight);
+
+        m_int.rclDst.xLeft   = vo_dx;
+        // invert Y
+        m_int.rclDst.yBottom = vo_screenheight - (vo_dy + d_height);
         m_int.rclDst.xRight  = m_int.rclDst.xLeft   + d_width;
         m_int.rclDst.yTop    = m_int.rclDst.yBottom + d_height;
 
         if (vo_fs) {
+            vo_dx = 0;
+            vo_dy = 0;
+
             d_width  = vo_screenwidth;
             d_height = vo_screenheight;
 
@@ -831,10 +840,11 @@ static int config(uint32_t width, uint32_t height,
             setAspectRatio(KVAR_FORCEANY);
         }
 
-        rcl.xLeft   = ((LONG)vo_screenwidth  - (LONG)d_width) / 2;
-        rcl.yBottom = ((LONG)vo_screenheight - (LONG)d_height) /2 ;
-        rcl.xRight  = rcl.xLeft              + d_width;
-        rcl.yTop    = rcl.yBottom            + d_height;
+        rcl.xLeft   = vo_dx;
+        // invert Y
+        rcl.yBottom = vo_screenheight - (vo_dy + d_height);
+        rcl.xRight  = rcl.xLeft   + d_width;
+        rcl.yTop    = rcl.yBottom + d_height;
     } else {
         vo_fs = 0;
 
-- 
2.30.0



More information about the MPlayer-dev-eng mailing list