[MPlayer-cvslog] r29630 - trunk/libvo/vo_quartz.c

reimar subversion at mplayerhq.hu
Wed Sep 2 16:02:15 CEST 2009


Author: reimar
Date: Wed Sep  2 16:02:15 2009
New Revision: 29630

Log:
Reduce code duplication for half/normal/double video size handling.

Modified:
   trunk/libvo/vo_quartz.c

Modified: trunk/libvo/vo_quartz.c
==============================================================================
--- trunk/libvo/vo_quartz.c	Wed Sep  2 13:38:18 2009	(r29629)
+++ trunk/libvo/vo_quartz.c	Wed Sep  2 16:02:15 2009	(r29630)
@@ -348,19 +348,31 @@ static OSStatus MouseEventHandler(EventH
     return result;
 }
 
+static void set_winSizeMult(float mult)
+{
+    int d_width, d_height;
+    aspect(&d_width, &d_height, A_NOZOOM);
+
+    if (vo_quartz_fs)
+    {
+        vo_fs = (!(vo_fs));
+        window_fullscreen();
+    }
+
+    winSizeMult = mult;
+    SizeWindow(theWindow, d_width * mult, d_height * mult, 1);
+    window_resized();
+}
+
 //default window event handler
 static OSStatus WindowEventHandler(EventHandlerCallRef nextHandler, EventRef event, void *userData)
 {
     OSStatus result = noErr;
-    uint32_t d_width;
-    uint32_t d_height;
     UInt32 class = GetEventClass(event);
     UInt32 kind = GetEventKind(event);
 
     result = CallNextEventHandler(nextHandler, event);
 
-    aspect(&d_width, &d_height, A_NOZOOM);
-
     if (class == kEventClassCommand)
     {
         HICommand theHICommand;
@@ -374,39 +386,15 @@ static OSStatus WindowEventHandler(Event
             break;
 
         case kHalfScreenCmd:
-            if (vo_quartz_fs)
-            {
-                vo_fs = (!(vo_fs));
-                window_fullscreen();
-            }
-
-            winSizeMult = 0.5;
-            SizeWindow(theWindow, d_width / 2, d_height / 2, 1);
-            window_resized();
+            set_winSizeMult(0.5);
             break;
 
         case kNormalScreenCmd:
-            if (vo_quartz_fs)
-            {
-                vo_fs = (!(vo_fs));
-                window_fullscreen();
-            }
-
-            winSizeMult = 1;
-            SizeWindow(theWindow, d_width, d_height, 1);
-            window_resized();
+            set_winSizeMult(1);
             break;
 
         case kDoubleScreenCmd:
-            if (vo_quartz_fs)
-            {
-                vo_fs = (!(vo_fs));
-                window_fullscreen();
-            }
-
-            winSizeMult = 2;
-            SizeWindow(theWindow, d_width * 2, d_height * 2, 1);
-            window_resized();
+            set_winSizeMult(2);
             break;
 
         case kFullScreenCmd:


More information about the MPlayer-cvslog mailing list