Implement new option -unevenstretchy (complementary to -unevenstretchx)

This commit is contained in:
Antonio Giner 2016-08-23 23:25:26 +02:00
parent b65c003cbe
commit a976bc2a2a
4 changed files with 13 additions and 4 deletions

View File

@ -87,6 +87,7 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
{ OPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" },
{ OPTION_UNEVENSTRETCHX ";uesx", "0", OPTION_BOOLEAN, "allow non-integer stretch factors only on horizontal axis"},
{ OPTION_UNEVENSTRETCHY ";uesy", "0", OPTION_BOOLEAN, "allow non-integer stretch factors only on vertical axis"},
{ OPTION_INTOVERSCAN ";ios", "0", OPTION_BOOLEAN, "allow overscan on integer scaled targets"},
{ OPTION_INTSCALEX ";sx", "0", OPTION_INTEGER, "set horizontal integer scale factor."},
{ OPTION_INTSCALEY ";sy", "0", OPTION_INTEGER, "set vertical integer scale."},

View File

@ -79,6 +79,7 @@
#define OPTION_KEEPASPECT "keepaspect"
#define OPTION_UNEVENSTRETCH "unevenstretch"
#define OPTION_UNEVENSTRETCHX "unevenstretchx"
#define OPTION_UNEVENSTRETCHY "unevenstretchy"
#define OPTION_INTOVERSCAN "intoverscan"
#define OPTION_INTSCALEX "intscalex"
#define OPTION_INTSCALEY "intscaley"
@ -265,6 +266,7 @@ public:
bool keep_aspect() const { return bool_value(OPTION_KEEPASPECT); }
bool uneven_stretch() const { return bool_value(OPTION_UNEVENSTRETCH); }
bool uneven_stretch_x() const { return bool_value(OPTION_UNEVENSTRETCHX); }
bool uneven_stretch_y() const { return bool_value(OPTION_UNEVENSTRETCHY); }
bool int_overscan() const { return bool_value(OPTION_INTOVERSCAN); }
int int_scale_x() const { return int_value(OPTION_INTSCALEX); }
int int_scale_y() const { return int_value(OPTION_INTSCALEY); }

View File

@ -935,10 +935,14 @@ 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 (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())
@ -1195,6 +1199,7 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height
}
case SCALE_FRACTIONAL_X:
case SCALE_FRACTIONAL_Y:
case SCALE_INTEGER:
{
// get source size and aspect
@ -1210,8 +1215,8 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height
float target_aspect = (float)target_width / (float)target_height * target_pixel_aspect;
// 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_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));
// first compute scale factors to fit the screen
float xscale = (float)target_width / src_width;

View File

@ -86,6 +86,7 @@ enum
{
SCALE_FRACTIONAL = 0, // compute fractional scaling factors for both axes
SCALE_FRACTIONAL_X, // compute fractional scaling factor for x-axis, and integer factor for y-axis
SCALE_FRACTIONAL_Y, // compute fractional scaling factor for y-axis, and integer factor for x-axis
SCALE_INTEGER // compute integer scaling factors for both axes, based on target dimensions
};