[Mplayer-cvslog] CVS: main/libvo vo_quartz.c,1.38,1.39

Nicolas Plourde CVS syncmail at mplayerhq.hu
Mon Nov 1 17:17:52 CET 2004


CVS change done by Nicolas Plourde CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv27131/libvo

Modified Files:
	vo_quartz.c 
Log Message:
more panscan fix

Index: vo_quartz.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_quartz.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- vo_quartz.c	30 Oct 2004 19:56:41 -0000	1.38
+++ vo_quartz.c	1 Nov 2004 16:17:49 -0000	1.39
@@ -100,6 +100,7 @@
 static WindowGroupRef winGroup = NULL;
 static CGContextRef context;
 static CGRect bounds;
+static GDHandle deviceHdl;
 
 static CGDataProviderRef dataProviderRef;
 static CGImageAlphaInfo alphaInfo;
@@ -110,6 +111,7 @@
 static Rect winRect; // size of the window containg the displayed image (include padding)
 static Rect oldWinRect; // size of the window containg the displayed image (include padding) when NOT in FS mode
 static Rect deviceRect; // size of the display device
+static Rect oldWinBounds;
 
 static MenuRef windMenu;
 static MenuRef movMenu;
@@ -139,6 +141,7 @@
 void window_resized();
 void window_ontop();
 void window_fullscreen();
+void window_panscan();
 
 static inline int convert_key(UInt32 key, UInt32 charcode)
 {
@@ -402,8 +405,8 @@
 				break;
 				
 			case kPanScanCmd:
-				vo_panscan = 1;
-				vo_fs = 1; window_fullscreen();
+				vo_panscan = (!(vo_panscan));
+				CheckMenuItem (aspectMenu, 2, vo_panscan);
 				break;
 			
 			default:
@@ -493,6 +496,7 @@
 	AppendMenuItemTextWithCFString(aspectMenu, CFSTR("Keep"), 0, kKeepAspectCmd, &index);
 	CheckMenuItem (aspectMenu, 1, vo_keepaspect);
 	AppendMenuItemTextWithCFString(aspectMenu, CFSTR("Pan-Scan"), 0, kPanScanCmd, &index);
+	CheckMenuItem (aspectMenu, 2, vo_panscan);
 	AppendMenuItemTextWithCFString(aspectMenu, NULL, kMenuItemAttrSeparator, NULL, &index);
 	AppendMenuItemTextWithCFString(aspectMenu, CFSTR("Original"), 0, kAspectOrgCmd, &index);
 	AppendMenuItemTextWithCFString(aspectMenu, CFSTR("4:3"), 0, kAspectFullCmd, &index);
@@ -537,7 +541,6 @@
 static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
 {
 	WindowAttributes	windowAttrs;
-	GDHandle			deviceHdl;
 	OSErr				qterr;
 	int i;
 
@@ -1106,7 +1109,7 @@
 		case VOCTRL_ONTOP: vo_ontop = (!(vo_ontop)); window_ontop(); return VO_TRUE;
 		case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data));
 		case VOCTRL_GET_PANSCAN: return VO_TRUE;
-		case VOCTRL_SET_PANSCAN: window_resized(); return VO_TRUE;
+		case VOCTRL_SET_PANSCAN: window_panscan(); return VO_TRUE;
 			
 		case VOCTRL_GET_IMAGE:
 			switch (image_format)
@@ -1176,13 +1179,6 @@
 	{
 		SetRect(&dstRect, 0, 0, winRect.right, winRect.bottom-border);
 	}
-	
-	if(vo_fs)
-	{
-		panscan_calc();
-		MoveWindow(theWindow, 0-(vo_panscan_x >> 1), 0-(vo_panscan_y >> 1), 1);
-		SizeWindow(theWindow, device_width+vo_panscan_x, device_height+vo_panscan_y,1);
-	}
 
 	//Clear Background
 	tmpBounds = CGRectMake( 0, border, winRect.right, winRect.bottom);
@@ -1256,9 +1252,6 @@
 void window_fullscreen()
 {
 	static Ptr restoreState = NULL;
-	RGBColor black={0,0,0};
-	GDHandle deviceHdl;
-	static Rect oldWinBounds;
 
 	//go fullscreen
 	if(vo_fs)
@@ -1270,10 +1263,9 @@
 			
 			if(fs_res_x != 0 || fs_res_y != 0)
 			{
-				BeginFullScreen( &restoreState, NULL, &fs_res_x, &fs_res_y, NULL, &black, NULL);
+				BeginFullScreen( &restoreState, deviceHdl, &fs_res_x, &fs_res_y, NULL, NULL, NULL);
 				
 				//Get Main device info///////////////////////////////////////////////////
-				deviceHdl = GetMainDevice();
 				deviceRect = (*deviceHdl)->gdRect;
         
 				device_width = deviceRect.right;
@@ -1290,9 +1282,10 @@
 		
 		//go fullscreen
 		border = 0;
+		panscan_calc();
 		ChangeWindowAttributes(theWindow, 0, kWindowResizableAttribute);
-		MoveWindow (theWindow, deviceRect.left, deviceRect.top, 1);		
-		SizeWindow(theWindow, device_width, device_height,1);
+		MoveWindow(theWindow, deviceRect.left-(vo_panscan_x >> 1), deviceRect.top-(vo_panscan_y >> 1), 1);
+		SizeWindow(theWindow, device_width+vo_panscan_x, device_height+vo_panscan_y,1);
 
 		vo_quartz_fs = 1;
 	}
@@ -1303,7 +1296,6 @@
 			EndFullScreen(restoreState, NULL);
 		
 			//Get Main device info///////////////////////////////////////////////////
-			deviceHdl = GetMainDevice();
 			deviceRect = (*deviceHdl)->gdRect;
         
 			device_width = deviceRect.right;
@@ -1325,3 +1317,19 @@
 	}
 	
 }
+
+void window_panscan()
+{
+	panscan_calc();
+	
+	if(vo_panscan > 0)
+		CheckMenuItem (aspectMenu, 2, 1);
+	else
+		CheckMenuItem (aspectMenu, 2, 0);
+	
+	if(vo_quartz_fs)
+	{
+		MoveWindow(theWindow, deviceRect.left-(vo_panscan_x >> 1), deviceRect.top-(vo_panscan_y >> 1), 1);
+		SizeWindow(theWindow, device_width+vo_panscan_x, device_height+vo_panscan_y,1);
+	}
+}




More information about the MPlayer-cvslog mailing list