changeset 29604:cd056d688db8

Factor out duplicated code to set play video scaled by a certain factor.
author reimar
date Fri, 04 Sep 2009 18:43:28 +0000
parents 4c81686ad728
children e960f06f4508
files libvo/vo_corevideo.m
diffstat 1 files changed, 21 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_corevideo.m	Fri Sep 04 18:21:28 2009 +0000
+++ b/libvo/vo_corevideo.m	Fri Sep 04 18:43:28 2009 +0000
@@ -594,58 +594,40 @@
 	[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));