diff options
| author | 2007-12-17 16:39:40 +0000 | |
|---|---|---|
| committer | 2007-12-17 16:39:40 +0000 | |
| commit | df34329a478833efbd542a424ce1813a11214d4a (patch) | |
| tree | 97960620a0153b267478c8f9ae93e55582ecaefa /src/osd | |
| parent | c82a966b3b72d79ac3ce394980d6b5806e752160 (diff) | |
Changes for MAME 0.121u3.mame0121u3
Diffstat (limited to 'src/osd')
| -rw-r--r-- | src/osd/windows/drawd3d.c | 35 | ||||
| -rw-r--r-- | src/osd/windows/winprefix.h | 2 |
2 files changed, 32 insertions, 5 deletions
diff --git a/src/osd/windows/drawd3d.c b/src/osd/windows/drawd3d.c index e819bf7f0e2..b082c54a43c 100644 --- a/src/osd/windows/drawd3d.c +++ b/src/osd/windows/drawd3d.c @@ -207,6 +207,33 @@ static const line_aa_step line_aa_4step[] = // INLINES //============================================================ +INLINE BOOL GetClientRectExceptMenu(HWND hWnd, PRECT pRect, BOOL fullscreen) +{ + static HMENU last_menu; + static RECT last_rect; + static RECT cached_rect; + HMENU menu = GetMenu(hWnd); + BOOL result = GetClientRect(hWnd, pRect); + + if (!fullscreen || !menu) + return result; + + // to avoid flicker use cache if we can use + if (last_menu != menu || memcmp(&last_rect, pRect, sizeof *pRect) != 0) + { + last_menu = menu; + last_rect = *pRect; + + SetMenu(hWnd, NULL); + result = GetClientRect(hWnd, &cached_rect); + SetMenu(hWnd, menu); + } + + *pRect = cached_rect; + return result; +} + + INLINE UINT32 ycc_to_rgb(UINT8 y, UINT8 cb, UINT8 cr) { /* original equations: @@ -535,7 +562,7 @@ static const render_primitive_list *drawd3d_window_get_primitives(win_window_inf d3d_info *d3d = window->drawdata; RECT client; - GetClientRect(window->hwnd, &client); + GetClientRectExceptMenu(window->hwnd, &client, window->fullscreen); if (rect_width(&client) > 0 && rect_height(&client) > 0) { render_target_set_bounds(window->target, rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor)); @@ -706,7 +733,7 @@ try_again: d3d->presentation.MultiSampleType = D3DMULTISAMPLE_NONE; d3d->presentation.SwapEffect = D3DSWAPEFFECT_DISCARD; d3d->presentation.hDeviceWindow = window->hwnd; - d3d->presentation.Windowed = !window->fullscreen || HAS_WINDOW_MENU; + d3d->presentation.Windowed = (!video_config.switchres || !window->fullscreen) || HAS_WINDOW_MENU; d3d->presentation.EnableAutoDepthStencil = FALSE; d3d->presentation.AutoDepthStencilFormat = D3DFMT_D16; d3d->presentation.Flags = 0; @@ -1112,7 +1139,7 @@ static int config_adapter_mode(win_window_info *window) RECT client; // bounds are from the window client rect - GetClientRect(window->hwnd, &client); + GetClientRectExceptMenu(window->hwnd, &client, window->fullscreen); d3d->width = client.right - client.left; d3d->height = client.bottom - client.top; @@ -1291,7 +1318,7 @@ static int update_window_size(win_window_info *window) RECT client; // get the current window bounds - GetClientRect(window->hwnd, &client); + GetClientRectExceptMenu(window->hwnd, &client, window->fullscreen); // if we have a device and matching width/height, nothing to do if (d3d->device != NULL && rect_width(&client) == d3d->width && rect_height(&client) == d3d->height) diff --git a/src/osd/windows/winprefix.h b/src/osd/windows/winprefix.h index fce57fb2f34..6d5f4acc7d2 100644 --- a/src/osd/windows/winprefix.h +++ b/src/osd/windows/winprefix.h @@ -26,7 +26,7 @@ void * realloc_file_line(void *memory, size_t size, const char *file, int line); #ifdef _MSC_VER void *__cdecl _alloca(size_t); #define alloca _alloca -#if _MSC_VER < 1400 +#if _MSC_VER < 1500 #define vsnprintf _vsnprintf #endif #endif |
