From 7d84852db673849427ddca37d8e5b91a6078ee7c Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 16 Dec 2020 23:31:53 -0500 Subject: [PATCH] Remove keepaspect and fullstretch members of osd_video_config --- src/osd/mac/video.cpp | 2 -- src/osd/mac/window.cpp | 9 +++++++-- src/osd/modules/osdwindow.h | 11 +++++++++-- src/osd/sdl/video.cpp | 2 -- src/osd/sdl/window.cpp | 10 +++++++--- src/osd/uwp/video.cpp | 1 - src/osd/uwp/window.cpp | 12 +++++++----- src/osd/windows/video.cpp | 1 - src/osd/windows/window.cpp | 14 ++++++++------ 9 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/osd/mac/video.cpp b/src/osd/mac/video.cpp index 4b62493cec6..6cfffb4b837 100644 --- a/src/osd/mac/video.cpp +++ b/src/osd/mac/video.cpp @@ -169,9 +169,7 @@ void mac_osd_interface::extract_video_config() video_config.windowed = options().window(); video_config.prescale = options().prescale(); video_config.filter = options().filter(); - video_config.keepaspect = options().keep_aspect(); video_config.numscreens = options().numscreens(); - video_config.fullstretch = options().uneven_stretch(); // if we are in debug mode, never go full screen if (machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) diff --git a/src/osd/mac/window.cpp b/src/osd/mac/window.cpp index 8a1f4d3fd3f..43134e26963 100644 --- a/src/osd/mac/window.cpp +++ b/src/osd/mac/window.cpp @@ -370,6 +370,7 @@ void mac_window_info::destroy() // free the render target, after the textures! machine().render().target_free(m_target); + m_target = nullptr; } @@ -579,9 +580,13 @@ int mac_window_info::complete_create() temp = m_windowed_dim; } else if (m_startmaximized) - temp = get_max_bounds(video_config.keepaspect ); + { + temp = get_max_bounds(keepaspect()); + } else - temp = get_min_bounds(video_config.keepaspect ); + { + temp = get_min_bounds(keepaspect()); + } // create the window ..... osd_printf_verbose("Enter mac_window_info::complete_create\n"); diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index 3fe020c56fe..7126b909d97 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -105,6 +105,15 @@ public: return orientation_swap_xy ^ rotation_swap_xy; }; + bool keepaspect() + { + render_target *target = this->target(); + if (target != nullptr) + return target->keepaspect(); + else + return machine().options().keep_aspect(); + } + virtual osd_dim get_size() = 0; virtual osd_monitor_info *monitor() const = 0; @@ -253,9 +262,7 @@ struct osd_video_config // global configuration int windowed; // start windowed? int prescale; // prescale factor - int keepaspect; // keep aspect ratio int numscreens; // number of screens - int fullstretch; // fractional stretch // hardware options int mode; // output mode diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index c00d86cd03e..9d9e2e64d56 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -175,9 +175,7 @@ void sdl_osd_interface::extract_video_config() video_config.windowed = options().window(); video_config.prescale = options().prescale(); video_config.filter = options().filter(); - video_config.keepaspect = options().keep_aspect(); video_config.numscreens = options().numscreens(); - video_config.fullstretch = options().uneven_stretch(); #ifdef SDLMAME_X11 video_config.restrictonemonitor = !options().use_all_heads(); #endif diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 712337b4dd7..b43d9299181 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -475,7 +475,7 @@ void sdl_window_info::destroy() // free the render target, after the textures! machine().render().target_free(m_target); - + m_target = nullptr; } @@ -681,9 +681,13 @@ int sdl_window_info::complete_create() temp = m_windowed_dim; } else if (m_startmaximized) - temp = get_max_bounds(video_config.keepaspect ); + { + temp = get_max_bounds(keepaspect()); + } else - temp = get_min_bounds(video_config.keepaspect ); + { + temp = get_min_bounds(keepaspect()); + } // create the window ..... diff --git a/src/osd/uwp/video.cpp b/src/osd/uwp/video.cpp index f63b76c037e..8ca19c75af0 100644 --- a/src/osd/uwp/video.cpp +++ b/src/osd/uwp/video.cpp @@ -142,7 +142,6 @@ void windows_osd_interface::extract_video_config() video_config.windowed = options().window(); video_config.prescale = options().prescale(); video_config.filter = options().filter(); - video_config.keepaspect = options().keep_aspect(); video_config.numscreens = options().numscreens(); // if we are in debug mode, never go full screen diff --git a/src/osd/uwp/window.cpp b/src/osd/uwp/window.cpp index 7aae818b958..9396e6ff308 100644 --- a/src/osd/uwp/window.cpp +++ b/src/osd/uwp/window.cpp @@ -463,6 +463,7 @@ void uwp_window_info::destroy() // free the render target machine().render().target_free(m_target); + m_target = nullptr; } @@ -952,8 +953,9 @@ void uwp_window_info::update_minmax_state() RECT bounds; // compare the maximum bounds versus the current bounds - osd_dim minbounds = get_min_bounds(video_config.keepaspect); - osd_dim maxbounds = get_max_bounds(video_config.keepaspect); + const bool keep_aspect = keepaspect(); + osd_dim minbounds = get_min_bounds(keep_aspect); + osd_dim maxbounds = get_max_bounds(keep_aspect); //GetWindowRect(platform_window(), &bounds); // if either the width or height matches, we were maximized @@ -980,7 +982,7 @@ void uwp_window_info::minimize_window() { assert(GetCurrentThreadId() == window_threadid); - osd_dim newsize = get_min_bounds(video_config.keepaspect); + osd_dim newsize = get_min_bounds(keepaspect()); // get the window rect //RECT bounds; @@ -1001,7 +1003,7 @@ void uwp_window_info::maximize_window() { assert(GetCurrentThreadId() == window_threadid); - osd_dim newsize = get_max_bounds(video_config.keepaspect); + osd_dim newsize = get_max_bounds(keepaspect()); // center within the work area osd_rect work = m_monitor->usuable_position_size(); @@ -1033,7 +1035,7 @@ void uwp_window_info::adjust_window_position_after_major_change() if (!fullscreen()) { // constrain the existing size to the aspect ratio - if (video_config.keepaspect) + if (keepaspect()) newrect = constrain_to_aspect_ratio(newrect, WMSZ_BOTTOMRIGHT); } diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index c6f4d3a0a89..c277e4a0c3c 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -150,7 +150,6 @@ void windows_osd_interface::extract_video_config() video_config.windowed = options().window(); video_config.prescale = options().prescale(); video_config.filter = options().filter(); - video_config.keepaspect = options().keep_aspect(); video_config.numscreens = options().numscreens(); // if we are in debug mode, never go full screen diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 5027455dfb6..7e7af0aa5ed 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -850,6 +850,7 @@ void win_window_info::destroy() // free the render target machine().render().target_free(m_target); + m_target = nullptr; } @@ -1308,7 +1309,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR case WM_SIZING: { RECT *rect = (RECT *)lparam; - if (video_config.keepaspect && !(GetAsyncKeyState(VK_CONTROL) & 0x8000)) + if (keepaspect() && !(GetAsyncKeyState(VK_CONTROL) & 0x8000)) { osd_rect r = window->constrain_to_aspect_ratio(RECT_to_osd_rect(*rect), wparam); rect->top = r.top(); @@ -1681,8 +1682,9 @@ void win_window_info::update_minmax_state() RECT bounds; // compare the maximum bounds versus the current bounds - osd_dim minbounds = get_min_bounds(video_config.keepaspect); - osd_dim maxbounds = get_max_bounds(video_config.keepaspect); + const bool keep_aspect = keepaspect(); + osd_dim minbounds = get_min_bounds(keep_aspect); + osd_dim maxbounds = get_max_bounds(keep_aspect); GetWindowRect(platform_window(), &bounds); // if either the width or height matches, we were maximized @@ -1709,7 +1711,7 @@ void win_window_info::minimize_window() { assert(GetCurrentThreadId() == window_threadid); - osd_dim newsize = get_min_bounds(video_config.keepaspect); + osd_dim newsize = get_min_bounds(keepaspect()); // get the window rect RECT bounds; @@ -1732,7 +1734,7 @@ void win_window_info::maximize_window() { assert(GetCurrentThreadId() == window_threadid); - osd_dim newsize = get_max_bounds(video_config.keepaspect); + osd_dim newsize = get_max_bounds(keepaspect()); // center within the work area osd_rect work = m_monitor->usuable_position_size(); @@ -1764,7 +1766,7 @@ void win_window_info::adjust_window_position_after_major_change() if (!fullscreen()) { // constrain the existing size to the aspect ratio - if (video_config.keepaspect) + if (keepaspect()) newrect = constrain_to_aspect_ratio(newrect, WMSZ_BOTTOMRIGHT); // restrict the window to one monitor and avoid toolbars if possible