mirror of
https://github.com/holub/mame
synced 2025-06-19 18:56:40 +03:00
Make overscan on integer scaled targets optional (add option -intoverscan).
This commit is contained in:
parent
106c5b3aac
commit
cf830e71da
@ -93,6 +93,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_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."},
|
||||
|
||||
|
@ -102,6 +102,7 @@ enum
|
||||
#define OPTION_KEEPASPECT "keepaspect"
|
||||
#define OPTION_UNEVENSTRETCH "unevenstretch"
|
||||
#define OPTION_UNEVENSTRETCHX "unevenstretchx"
|
||||
#define OPTION_INTOVERSCAN "intoverscan"
|
||||
#define OPTION_INTSCALEX "intscalex"
|
||||
#define OPTION_INTSCALEY "intscaley"
|
||||
|
||||
@ -296,6 +297,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 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); }
|
||||
|
||||
|
@ -934,6 +934,7 @@ render_target::render_target(render_manager &manager, const internal_layout *lay
|
||||
|
||||
// aspect and scale options
|
||||
m_keepaspect = (manager.machine().options().keep_aspect() && !(flags & RENDER_CREATE_HIDDEN));
|
||||
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())
|
||||
@ -1204,22 +1205,24 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height
|
||||
if (target_orientation & ORIENTATION_SWAP_XY)
|
||||
src_aspect = 1.0 / src_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;
|
||||
// get target aspect
|
||||
float target_aspect = (float)target_width / (float)target_height * target_pixel_aspect;
|
||||
|
||||
// apply aspect correction to destination rectangle
|
||||
if (dest_aspect > src_aspect)
|
||||
dest_width *= m_keepaspect? src_aspect / dest_aspect : 1.0f;
|
||||
else
|
||||
dest_height *= m_keepaspect? dest_aspect / src_aspect : 1.0f;
|
||||
// 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);
|
||||
|
||||
// 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));
|
||||
// first compute scale factors to fit the screen
|
||||
float xscale = (float)target_width / src_width;
|
||||
float yscale = (float)target_height / src_height;
|
||||
float maxxscale = MAX(1, m_int_overscan? render_round_nearest(xscale) : floor(xscale));
|
||||
float maxyscale = MAX(1, m_int_overscan? render_round_nearest(yscale) : floor(yscale));
|
||||
|
||||
// now apply desired scale mode and aspect correction
|
||||
if (m_keepaspect && target_aspect > src_aspect) xscale *= src_aspect / target_aspect * (maxyscale / yscale);
|
||||
if (m_keepaspect && target_aspect < src_aspect) yscale *= target_aspect / src_aspect * (maxxscale / xscale);
|
||||
if (x_is_integer) xscale = MIN(maxxscale, MAX(1, render_round_nearest(xscale)));
|
||||
if (y_is_integer) yscale = MIN(maxyscale, MAX(1, render_round_nearest(yscale)));
|
||||
|
||||
// check if we have user defined scale factors, if so use them instead
|
||||
xscale = m_int_scale_x? m_int_scale_x : xscale;
|
||||
|
@ -1008,6 +1008,7 @@ private:
|
||||
INT32 m_height; // height in pixels
|
||||
render_bounds m_bounds; // bounds of the target
|
||||
bool m_keepaspect; // constrain aspect ratio
|
||||
bool m_int_overscan; // allow overscan on integer scaled targets
|
||||
float m_pixel_aspect; // aspect ratio of individual pixels
|
||||
int m_scale_mode; // type of scale to apply
|
||||
int m_int_scale_x; // horizontal integer scale factor
|
||||
|
Loading…
Reference in New Issue
Block a user