diff options
Diffstat (limited to 'src/emu/render.cpp')
-rw-r--r-- | src/emu/render.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 39018410c2b..7e2ad4c2ca1 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -935,10 +935,16 @@ render_target::render_target(render_manager &manager, const internal_layout *lay m_int_overscan = manager.machine().options().int_overscan(); m_int_scale_x = manager.machine().options().int_scale_x(); m_int_scale_y = manager.machine().options().int_scale_y(); - if (manager.machine().options().uneven_stretch() && !manager.machine().options().uneven_stretch_x()) + if (m_manager.machine().options().auto_stretch_xy()) + m_scale_mode = SCALE_FRACTIONAL_AUTO; + else if (manager.machine().options().uneven_stretch_x()) + m_scale_mode = SCALE_FRACTIONAL_X; + else if (manager.machine().options().uneven_stretch_y()) + m_scale_mode = SCALE_FRACTIONAL_Y; + else if (manager.machine().options().uneven_stretch()) m_scale_mode = SCALE_FRACTIONAL; else - m_scale_mode = manager.machine().options().uneven_stretch_x() ? SCALE_FRACTIONAL_X : SCALE_INTEGER; + m_scale_mode = SCALE_INTEGER; // determine the base orientation based on options if (!manager.machine().options().rotate()) @@ -1194,8 +1200,7 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height break; } - case SCALE_FRACTIONAL_X: - case SCALE_INTEGER: + default: { // get source size and aspect INT32 src_width, src_height; @@ -1208,10 +1213,19 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height // get target aspect float target_aspect = (float)target_width / (float)target_height * target_pixel_aspect; + bool target_is_portrait = (target_aspect < 1.0f); + + // apply automatic axial stretching if required + int scale_mode = m_scale_mode; + if (m_scale_mode == SCALE_FRACTIONAL_AUTO) + { + bool is_rotated = (m_manager.machine().system().flags & ORIENTATION_SWAP_XY) ^ (target_orientation & ORIENTATION_SWAP_XY); + scale_mode = is_rotated ^ target_is_portrait ? SCALE_FRACTIONAL_Y : SCALE_FRACTIONAL_X; + } // determine the scale mode for each axis - bool x_is_integer = !(target_aspect >= 1.0f && m_scale_mode == SCALE_FRACTIONAL_X); - bool y_is_integer = !(target_aspect < 1.0f && m_scale_mode == SCALE_FRACTIONAL_X); + bool x_is_integer = !((!target_is_portrait && scale_mode == SCALE_FRACTIONAL_X) || (target_is_portrait && scale_mode == SCALE_FRACTIONAL_Y)); + bool y_is_integer = !((target_is_portrait && scale_mode == SCALE_FRACTIONAL_X) || (!target_is_portrait && scale_mode == SCALE_FRACTIONAL_Y)); // first compute scale factors to fit the screen float xscale = (float)target_width / src_width; @@ -1226,8 +1240,10 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height if (y_is_integer) yscale = std::min(maxyscale, std::max(1.0f, render_round_nearest(yscale))); // check if we have user defined scale factors, if so use them instead - xscale = m_int_scale_x > 0 ? m_int_scale_x : xscale; - yscale = m_int_scale_y > 0 ? m_int_scale_y : yscale; + int user_scale_x = target_is_portrait? m_int_scale_y : m_int_scale_x; + int user_scale_y = target_is_portrait? m_int_scale_x : m_int_scale_y; + xscale = user_scale_x > 0 ? user_scale_x : xscale; + yscale = user_scale_y > 0 ? user_scale_y : yscale; // set the final width/height visible_width = render_round_nearest(src_width * xscale); |