]> git.sesse.net Git - vlc/commitdiff
* fixed an issue with blackbars at certain aspect ratios when you resize
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 6 Mar 2003 12:52:32 +0000 (12:52 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 6 Mar 2003 12:52:32 +0000 (12:52 +0000)
  the video window. (half, double)

modules/gui/macosx/vout.m

index 887a784ee84c32813d75c738200bb887079ba827..7b2f0edf679c5303b3ccec2df72aad827bfb827c 100644 (file)
@@ -2,7 +2,7 @@
  * vout.m: MacOS X video output plugin
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
- * $Id: vout.m,v 1.37 2003/03/06 11:43:07 hartman Exp $
+ * $Id: vout.m,v 1.38 2003/03/06 12:52:32 hartman Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -745,7 +745,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
 - (void)scaleWindowWithFactor: (float)factor
 {
     NSSize newsize;
-    int i_corrected_height;
+    int i_corrected_height, i_corrected_width;
     NSPoint topleftbase;
     NSPoint topleftscreen;
     
@@ -755,10 +755,22 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
         topleftbase.y = [self frame].size.height;
         topleftscreen = [self convertBaseToScreen: topleftbase];
         
-        i_corrected_height = p_vout->output.i_width * VOUT_ASPECT_FACTOR /
+        if( p_vout->output.i_height * p_vout->output.i_aspect < 
+                        p_vout->output.i_width * VOUT_ASPECT_FACTOR )
+        {
+            i_corrected_width = p_vout->output.i_height * p_vout->output.i_aspect /
+                                            VOUT_ASPECT_FACTOR;
+            newsize.width = (int) ( i_corrected_width * factor );
+            newsize.height = (int) ( p_vout->render.i_height * factor );
+        }
+        else
+        {
+            i_corrected_height = p_vout->output.i_width * VOUT_ASPECT_FACTOR /
                                             p_vout->output.i_aspect;
-        newsize.width = (int) ( p_vout->render.i_width * factor );
-        newsize.height = (int) ( i_corrected_height * factor );
+            newsize.width = (int) ( p_vout->render.i_width * factor );
+            newsize.height = (int) ( i_corrected_height * factor );
+        }
+    
         [self setContentSize: newsize];
         
         [self setFrameTopLeftPoint: topleftscreen];