summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Antonio Giner <calamity15khz@gmail.com>2016-03-21 16:55:59 +0100
committer Antonio Giner <calamity15khz@gmail.com>2016-03-21 16:55:59 +0100
commitc1a77ecd92bcaf9a41aa5484e01c08d288b298af (patch)
treec71639107bc4792a0ff9bc0a5420945d6991e339
parentffb9d338435e0042b180bf5112318ef56f2d73dc (diff)
Apply better factors on multiple-screen views
-rw-r--r--src/emu/render.cpp37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index 0d14ce4510c..f47704050b5 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -1194,40 +1194,33 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height
case SCALE_FRACTIONAL_X:
case SCALE_INTEGER:
{
- // Get source size and aspect
+ // get source size and aspect
INT32 src_width, src_height;
compute_minimum_size(src_width, src_height);
float src_aspect = m_curview->effective_aspect(m_layerconfig);
- // Apply orientation if required
+ // apply orientation if required
if (target_orientation & ORIENTATION_SWAP_XY)
src_aspect = 1.0 / src_aspect;
-
- // Get destination size and aspect
+
+ // get destination size and aspect
float dest_width = (float)target_width;
float dest_height = (float)target_height;
float dest_aspect = dest_width / dest_height * target_pixel_aspect;
- // We need to work out which one is the horizontal axis, regardless of the monitor orientation
- float xscale, yscale;
- if (dest_aspect > 1.0)
- {
- // x-axis matches monitor's horizontal dimension
- dest_width *= m_keepaspect? src_aspect / dest_aspect : 1.0;
- xscale = m_scale_mode == SCALE_INTEGER?
- MAX(1, render_round_nearest(dest_width / src_width)) : dest_width / src_width;
- yscale = MAX(1, render_round_nearest(dest_height / src_height));
- }
+ // apply aspect correction to destination rectangle
+ if (dest_aspect > src_aspect)
+ dest_width *= m_keepaspect? src_aspect / dest_aspect : 1.0f;
else
- {
- // y-axis matches monitor's vertical dimension
- dest_height *= m_keepaspect? dest_aspect / src_aspect : 1.0;
- yscale = m_scale_mode == SCALE_INTEGER?
- MAX(1, render_round_nearest(dest_height / src_height)) : dest_height / src_height;
- xscale = MAX(1, render_round_nearest(dest_width / src_width));
- }
+ dest_height *= m_keepaspect? dest_aspect / src_aspect : 1.0f;
+
+ // compute scale factors
+ float xscale = dest_width / src_width;
+ float yscale = dest_height / src_height;
+ xscale = dest_aspect >= 1.0f && m_scale_mode == SCALE_FRACTIONAL_X? xscale : MAX(1, render_round_nearest(xscale));
+ yscale = dest_aspect < 1.0f && m_scale_mode == SCALE_FRACTIONAL_X? yscale : MAX(1, render_round_nearest(yscale));
- // Check if we have user defined scale factors, if so use them instead
+ // check if we have user defined scale factors, if so use them instead
xscale = m_int_scale_x? m_int_scale_x : xscale;
yscale = m_int_scale_y? m_int_scale_y : yscale;