Mercurial > mplayer.hg
changeset 13840:62af31e1bdc8
more panscan fix
author | nplourde |
---|---|
date | Mon, 01 Nov 2004 16:17:49 +0000 |
parents | 40391656ae23 |
children | 394deaee5d21 |
files | libvo/vo_quartz.c |
diffstat | 1 files changed, 27 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_quartz.c Mon Nov 01 14:46:57 2004 +0000 +++ b/libvo/vo_quartz.c Mon Nov 01 16:17:49 2004 +0000 @@ -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); + } +}