[MPlayer-cvslog] r29646 - trunk/libvo/vo_corevideo.m

reimar subversion at mplayerhq.hu
Fri Sep 4 20:43:29 CEST 2009


Author: reimar
Date: Fri Sep  4 20:43:28 2009
New Revision: 29646

Log:
Factor out duplicated code to set play video scaled by a certain factor.

Modified:
   trunk/libvo/vo_corevideo.m

Modified: trunk/libvo/vo_corevideo.m
==============================================================================
--- trunk/libvo/vo_corevideo.m	Fri Sep  4 20:21:28 2009	(r29645)
+++ trunk/libvo/vo_corevideo.m	Fri Sep  4 20:43:28 2009	(r29646)
@@ -594,58 +594,40 @@ static int control(uint32_t request, voi
 	[menuItem release];
 }
 
+- (void)set_winSizeMult:(float)mult
+{
+    NSRect frame;
+    int d_width, d_height;
+    aspect(&d_width, &d_height, A_NOZOOM);
+
+    if (isFullscreen) {
+        vo_fs = !vo_fs;
+        [self fullscreen:NO];
+    }
+
+    winSizeMult = mult;
+    frame.size.width  = d_width  * mult;
+    frame.size.height = d_height * mult;
+    [window setContentSize: frame.size];
+    [self reshape];
+}
+
 /*
 	Menu Action
  */
 - (void)menuAction:(id)sender
 {
-	uint32_t d_width;
-	uint32_t d_height;
-	NSRect frame;
-
-	aspect((int *)&d_width, (int *)&d_height,A_NOZOOM);
-
 	if(sender == kQuitCmd)
 	{
 		mplayer_put_key(KEY_ESC);
 	}
 
 	if(sender == kHalfScreenCmd)
-	{
-		if(isFullscreen) {
-			vo_fs = (!(vo_fs)); [self fullscreen:NO];
-		}
-
-		winSizeMult = 0.5;
-		frame.size.width = d_width*winSizeMult;
-		frame.size.height = d_height*winSizeMult;
-		[window setContentSize: frame.size];
-		[self reshape];
-	}
+		[self set_winSizeMult: 0.5];
 	if(sender == kNormalScreenCmd)
-	{
-		if(isFullscreen) {
-			vo_fs = (!(vo_fs)); [self fullscreen:NO];
-		}
-
-		winSizeMult = 1;
-		frame.size.width = d_width;
-		frame.size.height = d_height;
-		[window setContentSize: frame.size];
-		[self reshape];
-	}
+		[self set_winSizeMult: 1];
 	if(sender == kDoubleScreenCmd)
-	{
-		if(isFullscreen) {
-			vo_fs = (!(vo_fs)); [self fullscreen:NO];
-		}
-
-		winSizeMult = 2;
-		frame.size.width = d_width*winSizeMult;
-		frame.size.height = d_height*winSizeMult;
-		[window setContentSize: frame.size];
-		[self reshape];
-	}
+		[self set_winSizeMult: 2];
 	if(sender == kFullScreenCmd)
 	{
 		vo_fs = (!(vo_fs));


More information about the MPlayer-cvslog mailing list