[vlc-commits] splitter: wall: fix windows sizes

Victorien Le Couviour--Tuffet git at videolan.org
Wed Aug 2 19:19:32 CEST 2017


vlc | branch: master | Victorien Le Couviour--Tuffet <victorien.lecouviour.tuffet at gmail.com> | Wed Aug  2 16:37:14 2017 +0200| [723940fbad6877f17dba471396db4067af204d39] | committer: Rémi Denis-Courmont

splitter: wall: fix windows sizes

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/video_splitter/wall.c | 111 ++++--------------------------------------
 1 file changed, 10 insertions(+), 101 deletions(-)

diff --git a/modules/video_splitter/wall.c b/modules/video_splitter/wall.c
index e234ca3622..4bc3e378ff 100644
--- a/modules/video_splitter/wall.c
+++ b/modules/video_splitter/wall.c
@@ -191,88 +191,19 @@ static int Open( vlc_object_t *p_this )
         i_aspect = 4 * VOUT_ASPECT_FACTOR / 3;
 
     /* Compute placements/size of the windows */
-    const unsigned w1 = ( p_splitter->fmt.i_width / p_sys->i_col ) & ~1;
-    const unsigned h1 = ( w1 * VOUT_ASPECT_FACTOR / i_aspect ) & ~1;
-
-    const unsigned h2 = ( p_splitter->fmt.i_height / p_sys->i_row ) & ~1;
-    const unsigned w2 = ( h2 * i_aspect / VOUT_ASPECT_FACTOR ) & ~1;
-
-    unsigned i_target_width;
-    unsigned i_target_height;
-    unsigned i_hstart, i_hend;
-    unsigned i_vstart, i_vend;
-    bool b_vstart_rounded;
-    bool b_hstart_rounded;
-
-    if( h1 * p_sys->i_row < p_splitter->fmt.i_height )
-    {
-        i_target_width = w2;
-        i_target_height = h2;
-
-        i_vstart = 0;
-        b_vstart_rounded = false;
-        i_vend = p_splitter->fmt.i_height;
-
-        unsigned i_tmp = i_target_width * p_sys->i_col;
-        while( i_tmp < p_splitter->fmt.i_width )
-            i_tmp += p_sys->i_col;
-
-        i_hstart = (( i_tmp - p_splitter->fmt.i_width ) / 2)&~1;
-        b_hstart_rounded  = ( ( i_tmp - p_splitter->fmt.i_width ) % 2 ) ||
-            ( ( ( i_tmp - p_splitter->fmt.i_width ) / 2 ) & 1 );
-        i_hend = i_hstart + p_splitter->fmt.i_width;
-    }
-    else
-    {
-        i_target_height = h1;
-        i_target_width = w1;
-
-        i_hstart = 0;
-        b_hstart_rounded = false;
-        i_hend = p_splitter->fmt.i_width;
-
-        unsigned i_tmp = i_target_height * p_sys->i_row;
-        while( i_tmp < p_splitter->fmt.i_height )
-            i_tmp += p_sys->i_row;
-
-        i_vstart = ( ( i_tmp - p_splitter->fmt.i_height ) / 2 ) & ~1;
-        b_vstart_rounded  = ( ( i_tmp - p_splitter->fmt.i_height ) % 2 ) ||
-            ( ( ( i_tmp - p_splitter->fmt.i_height ) / 2 ) & 1 );
-        i_vend = i_vstart + p_splitter->fmt.i_height;
-    }
-    msg_Dbg( p_splitter, "target resolution %dx%d", i_target_width, i_target_height );
-    msg_Dbg( p_splitter, "target window (%d,%d)-(%d,%d)", i_hstart,i_vstart,i_hend,i_vend );
+    unsigned i_width = p_splitter->fmt.i_visible_width / p_sys->i_col;
+    unsigned i_height = p_splitter->fmt.i_visible_height / p_sys->i_row;
+    msg_Dbg( p_splitter, "target resolution %dx%d", i_width, i_height );
 
     int i_active = 0;
     for( int y = 0, i_top = 0; y < p_sys->i_row; y++ )
     {
         /* */
-        int i_height = 0;
         int i_halign = 0;
-        if( y * i_target_height >= i_vstart &&
-            ( y + 1 ) * i_target_height <= i_vend )
-        {
-            i_height = i_target_height;
-        }
-        else if( ( y + 1 ) * i_target_height < i_vstart ||
-                 ( y * i_target_height ) > i_vend )
-        {
-            i_height = 0;
-        }
+        if ( y >= ( p_sys->i_row / 2 ) )
+            i_halign = VOUT_ALIGN_BOTTOM;
         else
-        {
-            i_height = ( i_target_height -
-                         i_vstart%i_target_height );
-            if(  y >= ( p_sys->i_row / 2 ) )
-            {
-                i_halign = VOUT_ALIGN_TOP;
-                i_height -= b_vstart_rounded ? 2: 0;
-            }
-            else
-            {
-                i_halign = VOUT_ALIGN_BOTTOM;
-            }
-        }
+            i_halign = VOUT_ALIGN_TOP;
 
         /* */
         for( int x = 0, i_left = 0; x < p_sys->i_col; x++ )
@@ -280,35 +211,14 @@ static int Open( vlc_object_t *p_this )
             wall_output_t *p_output = &p_sys->pp_output[x][y];
 
             /* */
-            int i_width;
             int i_valign = 0;
-            if( x*i_target_width >= i_hstart &&
-                (x+1)*i_target_width <= i_hend )
-            {
-                i_width = i_target_width;
-            }
-            else if( ( x + 1 ) * i_target_width < i_hstart ||
-                     ( x * i_target_width ) > i_hend )
-            {
-                i_width = 0;
-            }
+            if( x >= ( p_sys->i_col / 2 ) )
+                i_valign = VOUT_ALIGN_RIGHT;
             else
-            {
-                i_width = ( i_target_width - i_hstart % i_target_width );
-                if( x >= ( p_sys->i_col / 2 ) )
-                {
-                    i_valign = VOUT_ALIGN_LEFT;
-                    i_width -= b_hstart_rounded ? 2: 0;
-                }
-                else
-                {
-                    i_valign = VOUT_ALIGN_RIGHT;
-                }
-            }
+                i_valign = VOUT_ALIGN_LEFT;
 
             /* */
-            p_output->b_active = pb_active[y * p_sys->i_col + x] &&
-                                 i_height > 0 && i_width > 0;
+            p_output->b_active = pb_active[y * p_sys->i_col + x];
             p_output->i_output = -1;
             p_output->i_align = i_valign | i_halign;
             p_output->i_width = i_width;
@@ -449,4 +359,3 @@ static int Mouse( video_splitter_t *p_splitter, vlc_mouse_t *p_mouse,
     vlc_assert_unreachable();
     return VLC_EGENERIC;
 }
-



More information about the vlc-commits mailing list