diff options
author | 2016-08-27 15:25:32 +0200 | |
---|---|---|
committer | 2016-08-27 22:12:29 +0200 | |
commit | aa326bd8e6b98cb96fed1c668b61db7a4e74dc33 (patch) | |
tree | 4e1d007b9ec22169db9b19e5ac468f8bff286a51 /src/emu/render.cpp | |
parent | a976bc2a2ab37bd98b14a94e95307558bc1647f8 (diff) |
Implement new option -autostretchxy, to automatically apply
-unevenstretchx or -unevenstretchy based on source native orientation.
Diffstat (limited to 'src/emu/render.cpp')
-rw-r--r-- | src/emu/render.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 8346411aca2..85f4f17a1c3 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -935,7 +935,9 @@ 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_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; @@ -1198,9 +1200,7 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height break; } - case SCALE_FRACTIONAL_X: - case SCALE_FRACTIONAL_Y: - case SCALE_INTEGER: + default: { // get source size and aspect INT32 src_width, src_height; @@ -1213,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) || (target_aspect < 1.0f && m_scale_mode == SCALE_FRACTIONAL_Y)); - bool y_is_integer = !((target_aspect < 1.0f && m_scale_mode == SCALE_FRACTIONAL_X) || (target_aspect >= 1.0f && m_scale_mode == SCALE_FRACTIONAL_Y)); + 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; |