summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/emu/emuopts.cpp6
-rw-r--r--src/emu/emuopts.h10
-rw-r--r--src/emu/layout/horizont.lay14
-rw-r--r--src/emu/layout/vertical.lay15
-rw-r--r--src/emu/render.cpp20
-rw-r--r--src/emu/render.h19
-rw-r--r--src/emu/rendlay.cpp155
-rw-r--r--src/emu/ui/dsplmenu.cpp3
-rw-r--r--src/osd/modules/lib/osdobj_common.cpp2
-rw-r--r--src/osd/modules/lib/osdobj_common.h4
-rw-r--r--src/osd/modules/osdwindow.h8
-rw-r--r--src/osd/modules/render/draw13.cpp4
-rw-r--r--src/osd/modules/render/drawbgfx.h2
-rw-r--r--src/osd/modules/render/drawd3d.cpp2
-rw-r--r--src/osd/modules/render/drawgdi.cpp2
-rw-r--r--src/osd/modules/render/drawnone.cpp2
-rw-r--r--src/osd/modules/render/drawogl.h6
-rw-r--r--src/osd/modules/render/drawsdl.cpp4
-rw-r--r--src/osd/sdl/video.cpp24
-rw-r--r--src/osd/sdl/window.cpp141
-rw-r--r--src/osd/sdl/window.h1
-rw-r--r--src/osd/windows/video.cpp15
-rw-r--r--src/osd/windows/video.h2
-rw-r--r--src/osd/windows/window.cpp94
-rw-r--r--src/osd/windows/winmain.cpp4
-rw-r--r--src/osd/windows/winmain.h6
26 files changed, 281 insertions, 284 deletions
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp
index f8127e28dbb..12d75930f40 100644
--- a/src/emu/emuopts.cpp
+++ b/src/emu/emuopts.cpp
@@ -88,6 +88,12 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_SPEED "(0.01-100)", "1.0", OPTION_FLOAT, "controls the speed of gameplay, relative to realtime; smaller numbers are slower" },
{ OPTION_REFRESHSPEED ";rs", "0", OPTION_BOOLEAN, "automatically adjusts the speed of gameplay to keep the refresh rate lower than the screen" },
+ // render options
+ { nullptr, nullptr, OPTION_HEADER, "CORE RENDER OPTIONS" },
+ { OPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
+ { OPTION_INTSCALEX ";sx", "0", OPTION_INTEGER, "set horizontal scale factor for integer scaled views."},
+ { OPTION_INTSCALEY ";sy", "0", OPTION_INTEGER, "set vertical scale factor for integer scaled views."},
+
// rotation options
{ nullptr, nullptr, OPTION_HEADER, "CORE ROTATION OPTIONS" },
{ OPTION_ROTATE, "1", OPTION_BOOLEAN, "rotate the game screen according to the game's orientation needs it" },
diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h
index 0512924dd59..3e80f79a065 100644
--- a/src/emu/emuopts.h
+++ b/src/emu/emuopts.h
@@ -98,6 +98,11 @@ enum
#define OPTION_SPEED "speed"
#define OPTION_REFRESHSPEED "refreshspeed"
+// core render options
+#define OPTION_KEEPASPECT "keepaspect"
+#define OPTION_INTSCALEX "intscalex"
+#define OPTION_INTSCALEY "intscaley"
+
// core rotation options
#define OPTION_ROTATE "rotate"
#define OPTION_ROR "ror"
@@ -282,6 +287,11 @@ public:
float speed() const { return float_value(OPTION_SPEED); }
bool refresh_speed() const { return m_refresh_speed; }
+ // core render options
+ bool keep_aspect() const { return bool_value(OPTION_KEEPASPECT); }
+ int int_scale_x() const { return int_value(OPTION_INTSCALEX); }
+ int int_scale_y() const { return int_value(OPTION_INTSCALEY); }
+
// core rotation options
bool rotate() const { return bool_value(OPTION_ROTATE); }
bool ror() const { return bool_value(OPTION_ROR); }
diff --git a/src/emu/layout/horizont.lay b/src/emu/layout/horizont.lay
index 908804832af..b141aedb065 100644
--- a/src/emu/layout/horizont.lay
+++ b/src/emu/layout/horizont.lay
@@ -12,6 +12,20 @@
</screen>
</view>
+ <view name="Integer">
+ <bounds x="0" y="0" width="1" height="1" scaletype="3" />
+ <screen index="0">
+ <bounds left="0" top="0" right="~scr0width~" bottom="~scr0height~" aspectx="4" aspecty="3" scaletype="1" />
+ </screen>
+ </view>
+
+ <view name="Stretch-H">
+ <bounds x="0" y="0" width="1" height="1" scaletype="3" />
+ <screen index="0">
+ <bounds left="0" top="0" right="~scr0width~" bottom="~scr0height~" aspectx="4" aspecty="3" scaletype="2" />
+ </screen>
+ </view>
+
<view name="Cocktail">
<screen index="0">
<bounds x="0" y="-3.03" width="4" height="3" />
diff --git a/src/emu/layout/vertical.lay b/src/emu/layout/vertical.lay
index 2d66df317f8..b95e8799258 100644
--- a/src/emu/layout/vertical.lay
+++ b/src/emu/layout/vertical.lay
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<mamelayout version="2">
+
<view name="Standard (3:4)">
<screen index="0">
<bounds left="0" top="0" right="3" bottom="4" />
@@ -12,6 +13,20 @@
</screen>
</view>
+ <view name="Integer">
+ <bounds x="0" y="0" width="1" height="1" scaletype="3" />
+ <screen index="0">
+ <bounds left="0" top="0" right="~scr0height~" bottom="~scr0width~" aspectx="3" aspecty="4" scaletype="1" />
+ </screen>
+ </view>
+
+ <view name="Stretch-H">
+ <bounds x="0" y="0" width="1" height="1" scaletype="3" />
+ <screen index="0">
+ <bounds left="0" top="0" right="~scr0height~" bottom="~scr0width~" aspectx="3" aspecty="4" scaletype="2" />
+ </screen>
+ </view>
+
<view name="Cocktail">
<screen index="0">
<bounds x="-3.03" y="0" width="3" height="4" />
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index 806921f8981..abe7ee87cc7 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -931,6 +931,9 @@ render_target::render_target(render_manager &manager, const char *layoutfile, UI
m_base_layerconfig.set_marquees_enabled(manager.machine().options().use_marquees());
m_base_layerconfig.set_zoom_to_screen(manager.machine().options().artwork_crop());
+ // aspect and scale options
+ m_keepaspect = manager.machine().options().keep_aspect();
+
// determine the base orientation based on options
if (!manager.machine().options().rotate())
m_base_orientation = orientation_reverse(manager.machine().system().flags & ORIENTATION_MASK);
@@ -1005,7 +1008,11 @@ void render_target::set_bounds(INT32 width, INT32 height, float pixel_aspect)
m_bounds.x0 = m_bounds.y0 = 0;
m_bounds.x1 = (float)width;
m_bounds.y1 = (float)height;
- m_pixel_aspect = pixel_aspect;
+ m_pixel_aspect = pixel_aspect != 0.0? pixel_aspect : 1.0;
+
+ // Check if our layout needs to be recomputed
+ if (m_curview != nullptr && m_curview->set_physical_size(width, height, m_pixel_aspect, m_orientation))
+ m_curview->recompute(m_layerconfig);
}
@@ -1144,7 +1151,7 @@ void render_target::compute_visible_area(INT32 target_width, INT32 target_height
float scale;
// constrained case
- if (target_pixel_aspect != 0.0f)
+ if (m_keepaspect)
{
// start with the aspect ratio of the square pixel layout
width = m_curview->effective_aspect(m_layerconfig);
@@ -1214,7 +1221,12 @@ void render_target::compute_minimum_size(INT32 &minwidth, INT32 &minheight)
const rectangle &visarea = (screen->screen_type() == SCREEN_TYPE_VECTOR) ? vectorvis : screen->visible_area();
// apply target orientation to the bounds
- render_bounds bounds = curitem->bounds();
+ render_bounds bounds;
+ if (m_curview->bounds().scale_type == RENDER_SCALE_FRACTIONAL)
+ bounds = curitem->bounds();
+ else
+ set_render_bounds_wh(&bounds, 0, 0, 1, 1);
+
apply_orientation(bounds, m_orientation);
normalize_bounds(bounds);
@@ -2528,7 +2540,7 @@ float render_manager::ui_aspect(render_container *rc)
// if we have a valid pixel aspect, apply that and return
if (m_ui_target->pixel_aspect() != 0.0f)
- return (aspect / m_ui_target->pixel_aspect());
+ aspect /= m_ui_target->pixel_aspect();
} else {
// single screen container
diff --git a/src/emu/render.h b/src/emu/render.h
index 09fe68282ef..c968d2207dc 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -73,6 +73,11 @@ const UINT8 RENDER_CREATE_NO_ART = 0x01; // ignore any views that
const UINT8 RENDER_CREATE_SINGLE_FILE = 0x02; // only load views from the file specified
const UINT8 RENDER_CREATE_HIDDEN = 0x04; // don't make this target visible
+// render scaling types
+const UINT32 RENDER_SCALE_FRACTIONAL = 0x00; // compute bounds using dimensionless proportions (default)
+const UINT32 RENDER_SCALE_INTEGER = 0x01; // compute integer scaling factors for both axes, based on target dimensions
+const UINT32 RENDER_SCALE_STRETCH_H = 0x02; // compute fractional scaling factor for x-axis, and integer factor for y-axis
+const UINT32 RENDER_SCALE_STRETCH_FULL = 0x03; // match bounds with physical target dimensions in pixels
// flags for primitives
const int PRIMFLAG_TEXORIENT_SHIFT = 0;
@@ -168,6 +173,8 @@ struct render_bounds
float y0; // topmost Y coordinate
float x1; // rightmost X coordinate
float y1; // bottommost Y coordinate
+ float aspect; // aspect ratio for this item
+ int scale_type; // type of scale for this item
float width() const { return x1 - x0; }
float height() const { return y1 - y0; }
@@ -802,6 +809,7 @@ public:
int m_orientation; // orientation of this item
render_bounds m_bounds; // bounds of the item
render_bounds m_rawbounds; // raw (original) bounds of the item
+ render_bounds m_scaledbounds; // raw bounds of the item after scale is applied
render_color m_color; // color of the item
};
@@ -817,6 +825,7 @@ public:
const render_bounds &screen_bounds() const { return m_scrbounds; }
const render_screen_list &screens() const { return m_screens; }
bool layer_enabled(item_layer layer) const { return m_layenabled[layer]; }
+ int physical_width() const { return m_physical_width; }
//
bool has_art() const { return (m_backdrop_list.count() + m_overlay_list.count() + m_bezel_list.count() + m_cpanel_list.count() + m_marquee_list.count() != 0); }
@@ -824,6 +833,8 @@ public:
// operations
void recompute(render_layer_config layerconfig);
+ bool set_physical_size(INT32 new_width, INT32 new_height, float new_pixel_aspect, int new_orientation);
+ void scale_bounds(render_bounds *dest, const render_bounds *src);
// resolve tags, if any
void resolve_tags();
@@ -834,6 +845,13 @@ private:
std::string m_name; // name of the layout
float m_aspect; // X/Y of the layout
float m_scraspect; // X/Y of the screen areas
+ int m_physical_width; // render_target's width in pixels
+ int m_physical_height; // render_target's height in pixels
+ float m_pixel_aspect; // render_target's pixel aspect
+ int m_orientation; // render target's orientation
+ bool m_keepaspect; // constrain aspect ratio
+ int m_int_scale_x; // horizontal integer scale factor
+ int m_int_scale_y; // vertical integer scale factor
render_screen_list m_screens; // list of active screens
render_bounds m_bounds; // computed bounds of the view
render_bounds m_scrbounds; // computed bounds of the screens within the view
@@ -994,6 +1012,7 @@ private:
INT32 m_width; // width in pixels
INT32 m_height; // height in pixels
render_bounds m_bounds; // bounds of the target
+ bool m_keepaspect; // constrain aspect ratio
float m_pixel_aspect; // aspect ratio of individual pixels
float m_max_refresh; // maximum refresh rate, 0 or if none
int m_orientation; // orientation
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp
index a69ea831e44..a2c5b15d576 100644
--- a/src/emu/rendlay.cpp
+++ b/src/emu/rendlay.cpp
@@ -100,6 +100,14 @@ enum
//**************************************************************************
+// MACROS
+//**************************************************************************
+
+#define FSWAP(var1, var2) do { float temp = var1; var1 = var2; var2 = temp; } while (0)
+
+
+
+//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
@@ -305,6 +313,11 @@ void parse_bounds(running_machine &machine, xml_data_node *boundsnode, render_bo
}
// parse out the data
+ bounds.scale_type = xml_get_attribute_int_with_subst(machine, *boundsnode, "scaletype", 0);
+ int aspectx = xml_get_attribute_int_with_subst(machine, *boundsnode, "aspectx", 1);
+ int aspecty = xml_get_attribute_int_with_subst(machine, *boundsnode, "aspecty", 1);
+ bounds.aspect = (float)aspectx / (float)aspecty;
+
if (xml_get_attribute(boundsnode, "left") != nullptr)
{
// left/right/top/bottom format
@@ -2132,7 +2145,13 @@ void layout_element::component::apply_skew(bitmap_argb32 &dest, int skewwidth)
layout_view::layout_view(running_machine &machine, xml_data_node &viewnode, simple_list<layout_element> &elemlist)
: m_next(nullptr),
m_aspect(1.0f),
- m_scraspect(1.0f)
+ m_scraspect(1.0f),
+ m_physical_width(0),
+ m_physical_height(0),
+ m_orientation(0),
+ m_keepaspect(machine.options().keep_aspect()),
+ m_int_scale_x(machine.options().int_scale_x()),
+ m_int_scale_y(machine.options().int_scale_y())
{
// allocate a copy of the name
m_name = xml_get_attribute_string_with_subst(machine, viewnode, "name", "");
@@ -2233,20 +2252,23 @@ void layout_view::recompute(render_layer_config layerconfig)
if (m_layenabled[layer])
for (item *curitem = first_item(layer); curitem != nullptr; curitem = curitem->next())
{
+ // fist apply scale to item bounds if required
+ scale_bounds(&curitem->m_scaledbounds, &curitem->m_rawbounds);
+
// accumulate bounds
if (first)
- m_bounds = curitem->m_rawbounds;
+ m_bounds = curitem->m_scaledbounds;
else
- union_render_bounds(&m_bounds, &curitem->m_rawbounds);
+ union_render_bounds(&m_bounds, &curitem->m_scaledbounds);
first = false;
// accumulate screen bounds
if (curitem->m_screen != nullptr)
{
if (scrfirst)
- m_scrbounds = curitem->m_rawbounds;
+ m_scrbounds = curitem->m_scaledbounds;
else
- union_render_bounds(&m_scrbounds, &curitem->m_rawbounds);
+ union_render_bounds(&m_scrbounds, &curitem->m_scaledbounds);
scrfirst = false;
// accumulate the screens in use while we're scanning
@@ -2257,7 +2279,7 @@ void layout_view::recompute(render_layer_config layerconfig)
// if we have an explicit bounds, override it
if (m_expbounds.x1 > m_expbounds.x0)
- m_bounds = m_expbounds;
+ scale_bounds(&m_bounds, &m_expbounds);
// if we're handling things normally, the target bounds are (0,0)-(1,1)
render_bounds target_bounds;
@@ -2294,14 +2316,127 @@ void layout_view::recompute(render_layer_config layerconfig)
for (item_layer layer = ITEM_LAYER_FIRST; layer < ITEM_LAYER_MAX; ++layer)
for (item *curitem = first_item(layer); curitem != nullptr; curitem = curitem->next())
{
- curitem->m_bounds.x0 = target_bounds.x0 + (curitem->m_rawbounds.x0 - xoffs) * xscale;
- curitem->m_bounds.x1 = target_bounds.x0 + (curitem->m_rawbounds.x1 - xoffs) * xscale;
- curitem->m_bounds.y0 = target_bounds.y0 + (curitem->m_rawbounds.y0 - yoffs) * yscale;
- curitem->m_bounds.y1 = target_bounds.y0 + (curitem->m_rawbounds.y1 - yoffs) * yscale;
+ curitem->m_bounds.x0 = target_bounds.x0 + (curitem->m_scaledbounds.x0 - xoffs) * xscale;
+ curitem->m_bounds.x1 = target_bounds.x0 + (curitem->m_scaledbounds.x1 - xoffs) * xscale;
+ curitem->m_bounds.y0 = target_bounds.y0 + (curitem->m_scaledbounds.y0 - yoffs) * yscale;
+ curitem->m_bounds.y1 = target_bounds.y0 + (curitem->m_scaledbounds.y1 - yoffs) * yscale;
}
}
+//-------------------------------------------------
+// set_physical_size - update our physical size
+// information
+//-------------------------------------------------
+
+bool layout_view::set_physical_size(INT32 new_width, INT32 new_height, float new_pixel_aspect, int new_orientation)
+{
+ if ((new_width != 0 && new_height != 0 && new_pixel_aspect != 0.0f) &&
+ (new_width != m_physical_width || new_height != m_physical_height || new_pixel_aspect != m_pixel_aspect || new_orientation != m_orientation))
+ {
+ // physical size has changed
+ m_physical_width = new_width;
+ m_physical_height = new_height;
+ m_pixel_aspect = new_pixel_aspect;
+ m_orientation = new_orientation;
+ return true;
+ }
+ // physical size was already up-to-date
+ return false;
+}
+
+
+//-------------------------------------------------
+// scale_bounds - apply proper scale type
+// to render_bounds
+//-------------------------------------------------
+
+void layout_view::scale_bounds(render_bounds *dest, const render_bounds *src)
+{
+ // Start with the raw bounds from the layout file
+ if (src == nullptr || dest == nullptr)
+ return;
+
+ *dest = *src;
+
+ // Get the physical size and properties of the render target which owns us
+ int target_width = m_physical_width;
+ int target_height = m_physical_height;
+ float pixel_aspect = m_keepaspect? m_pixel_aspect: 1.0;
+
+ if (target_width == 0 || target_height == 0)
+ return;
+
+ // Apply orientation if required
+ if (m_orientation & ORIENTATION_SWAP_XY)
+ {
+ FSWAP(target_width, target_height);
+ pixel_aspect = 1.0 / pixel_aspect;
+ }
+
+ // Now, based on the defined scale type for these bounds, apply different methods
+ switch (src->scale_type)
+ {
+ // Fractional: default for standard views (scaletype not defined), just preserve the raw bounds
+ case RENDER_SCALE_FRACTIONAL:
+ break;
+
+ // Full stretch: bounds are scaled to whole size of the render target. Used by integer scaled views
+ // to define the bounds of the actual "view".
+ case RENDER_SCALE_STRETCH_FULL:
+ {
+ dest->x0 *= target_width * pixel_aspect;
+ dest->y0 *= target_height;
+ dest->x1 *= target_width * pixel_aspect;
+ dest->y1 *= target_height;
+ break;
+ }
+
+ // Integer/Strecth-H: bounds are scaled by integer factors. For the Stretch-H case, integer scaling is
+ // only applied to the vertical axis. Used by integer scaled views, to define the bounds of the "screen".
+ case RENDER_SCALE_INTEGER:
+ case RENDER_SCALE_STRETCH_H:
+ {
+ float dest_width, dest_width_asp, dest_height, dest_height_asp, dest_aspect;
+ dest_width = dest_width_asp = (float)target_width;
+ dest_height = dest_height_asp = (float)target_height;
+ dest_aspect = dest_width / dest_height * pixel_aspect;
+
+ // We need to work out which one is the horizontal axis, regardless of the monitor orientation
+ float x_scale, y_scale;
+ if (dest_aspect > 1.0)
+ {
+ // x-axis matches monitor's horizontal dimension
+ dest_width_asp *= m_keepaspect? src->aspect / dest_aspect : 1.0;
+ x_scale = src->scale_type == RENDER_SCALE_INTEGER?
+ MAX(1, render_round_nearest(dest_width_asp / src->width())) : dest_width_asp / src->width();
+ y_scale = MAX(1, render_round_nearest(dest_height / src->height()));
+ }
+ else
+ {
+ // y-axis matches monitor's vertical dimension
+ dest_height_asp *= m_keepaspect? dest_aspect / src->aspect : 1.0;
+ y_scale = src->scale_type == RENDER_SCALE_INTEGER?
+ MAX(1, render_round_nearest(dest_height_asp / src->height())) : dest_height_asp / src->height();
+ x_scale = MAX(1, render_round_nearest(dest_width / src->width()));
+ }
+
+ // Check if we have user defined scale factors, if so use them instead
+ x_scale = m_int_scale_x? m_int_scale_x : x_scale;
+ y_scale = m_int_scale_y? m_int_scale_y : y_scale;
+
+ // Finally, apply scale to bounds
+ float new_width = src->width() * x_scale;
+ float new_height = src->height() * y_scale;
+ float x_border = (dest_width - new_width) / 2;
+ float y_border = (dest_height - new_height) / 2;
+ set_render_bounds_wh(dest, x_border * pixel_aspect, y_border, new_width * pixel_aspect, new_height);
+ break;
+ }
+ }
+}
+
+
//-----------------------------
// resolve_tags - resolve tags
//-----------------------------
diff --git a/src/emu/ui/dsplmenu.cpp b/src/emu/ui/dsplmenu.cpp
index 5ee2bfd0ca2..d0d308d3bb9 100644
--- a/src/emu/ui/dsplmenu.cpp
+++ b/src/emu/ui/dsplmenu.cpp
@@ -37,7 +37,6 @@ ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = {
{ 0, nullptr, nullptr },
{ 0, __("Video Mode"), OSDOPTION_VIDEO },
#if defined(UI_WINDOWS) && !defined(UI_SDL)
- { 0, __("Hardware Stretch"), WINOPTION_HWSTRETCH },
{ 0, __("Triple Buffering"), WINOPTION_TRIPLEBUFFER },
{ 0, __("HLSL"), WINOPTION_HLSL_ENABLE },
#endif
@@ -46,7 +45,7 @@ ui_menu_display_options::dspl_option ui_menu_display_options::m_options[] = {
{ 0, __("Bitmap Prescaling"), OSDOPTION_PRESCALE },
{ 0, __("Multi-Threaded Rendering"), OSDOPTION_MULTITHREADING },
{ 0, __("Window Mode"), OSDOPTION_WINDOW },
- { 0, __("Enforce Aspect Ratio"), OSDOPTION_KEEPASPECT },
+ { 0, __("Enforce Aspect Ratio"), OPTION_KEEPASPECT },
{ 0, __("Start Out Maximized"), OSDOPTION_MAXIMIZE },
{ 0, __("Synchronized Refresh"), OSDOPTION_SYNCREFRESH },
{ 0, __("Wait Vertical Sync"), OSDOPTION_WAITVSYNC }
diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp
index 30c77a12211..100b8bba0c8 100644
--- a/src/osd/modules/lib/osdobj_common.cpp
+++ b/src/osd/modules/lib/osdobj_common.cpp
@@ -52,8 +52,6 @@ const options_entry osd_options::s_option_entries[] =
{ OSDOPTION_NUMSCREENS "(1-4)", "1", OPTION_INTEGER, "number of screens to create; usually, you want just one" },
{ OSDOPTION_WINDOW ";w", "0", OPTION_BOOLEAN, "enable window mode; otherwise, full screen mode is assumed" },
{ OSDOPTION_MAXIMIZE ";max", "1", OPTION_BOOLEAN, "default to maximized windows; otherwise, windows will be minimized" },
- { OSDOPTION_KEEPASPECT ";ka", "1", OPTION_BOOLEAN, "constrain to the proper aspect ratio" },
- { OSDOPTION_UNEVENSTRETCH ";ues", "1", OPTION_BOOLEAN, "allow non-integer stretch factors" },
{ OSDOPTION_WAITVSYNC ";vs", "0", OPTION_BOOLEAN, "enable waiting for the start of VBLANK before flipping screens; reduces tearing effects" },
{ OSDOPTION_SYNCREFRESH ";srf", "0", OPTION_BOOLEAN, "enable using the start of VBLANK for throttling instead of the game time" },
diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h
index 27e8d29d4a5..a2418cfc8b7 100644
--- a/src/osd/modules/lib/osdobj_common.h
+++ b/src/osd/modules/lib/osdobj_common.h
@@ -45,8 +45,6 @@
#define OSDOPTION_NUMSCREENS "numscreens"
#define OSDOPTION_WINDOW "window"
#define OSDOPTION_MAXIMIZE "maximize"
-#define OSDOPTION_KEEPASPECT "keepaspect"
-#define OSDOPTION_UNEVENSTRETCH "unevenstretch"
#define OSDOPTION_WAITVSYNC "waitvsync"
#define OSDOPTION_SYNCREFRESH "syncrefresh"
@@ -109,8 +107,6 @@ public:
int numscreens() const { return int_value(OSDOPTION_NUMSCREENS); }
bool window() const { return bool_value(OSDOPTION_WINDOW); }
bool maximize() const { return bool_value(OSDOPTION_MAXIMIZE); }
- bool keep_aspect() const { return bool_value(OSDOPTION_KEEPASPECT); }
- bool uneven_stretch() const { return bool_value(OSDOPTION_UNEVENSTRETCH); }
bool wait_vsync() const { return bool_value(OSDOPTION_WAITVSYNC); }
bool sync_refresh() const { return bool_value(OSDOPTION_SYNCREFRESH); }
diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h
index 6081d47c010..b27a3b299be 100644
--- a/src/osd/modules/osdwindow.h
+++ b/src/osd/modules/osdwindow.h
@@ -110,8 +110,10 @@ public:
const char *devicename() { return m_name[0] ? m_name : "UNKNOWN"; }
- float aspect();
+ float aspect() { return m_aspect; }
+ float pixel_aspect() { return m_aspect / ((float)m_pos_size.width() / (float)m_pos_size.height()); }
+ void update_resolution(const int new_width, const int new_height) { m_pos_size.resize(new_width, new_height); }
void set_aspect(const float a) { m_aspect = a; }
bool is_primary() { return m_is_primary; }
@@ -131,6 +133,7 @@ private:
void * m_handle; // handle to the monitor
float m_aspect; // computed/configured aspect ratio of the physical device
+ float m_pixel_aspect; // computed pixel aspect ratio
};
class osd_window_config
@@ -166,12 +169,11 @@ public:
int prescale() const { return m_prescale; };
- float aspect() const { return monitor()->aspect(); }
+ float pixel_aspect() const { return monitor()->pixel_aspect(); }
virtual osd_dim get_size() = 0;
#ifdef OSD_SDL
- virtual osd_dim blit_surface_size() = 0;
virtual osd_monitor_info *monitor() const = 0;
virtual SDL_Window *sdl_window() = 0;
#else
diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp
index acf946b715d..f189fc48cca 100644
--- a/src/osd/modules/render/draw13.cpp
+++ b/src/osd/modules/render/draw13.cpp
@@ -960,12 +960,12 @@ texture_info * renderer_sdl1::texture_update(const render_primitive &prim)
render_primitive_list *renderer_sdl1::get_primitives()
{
- osd_dim nd = window().blit_surface_size();
+ osd_dim nd = window().get_size();
if (nd != m_blit_dim)
{
m_blit_dim = nd;
notify_changed();
}
- window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect());
+ window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().pixel_aspect());
return &window().target()->get_primitives();
}
diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h
index 806bc651344..5da751964c4 100644
--- a/src/osd/modules/render/drawbgfx.h
+++ b/src/osd/modules/render/drawbgfx.h
@@ -49,7 +49,7 @@ public:
virtual render_primitive_list *get_primitives() override
{
osd_dim wdim = window().get_size();
- window().target()->set_bounds(wdim.width(), wdim.height(), window().aspect());
+ window().target()->set_bounds(wdim.width(), wdim.height(), window().pixel_aspect());
return &window().target()->get_primitives();
}
diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp
index e927c36458f..4b8cc430640 100644
--- a/src/osd/modules/render/drawd3d.cpp
+++ b/src/osd/modules/render/drawd3d.cpp
@@ -204,7 +204,7 @@ render_primitive_list *renderer_d3d9::get_primitives()
GetClientRectExceptMenu(window().m_hwnd, &client, window().fullscreen());
if (rect_width(&client) > 0 && rect_height(&client) > 0)
{
- window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
+ window().target()->set_bounds(rect_width(&client), rect_height(&client), window().pixel_aspect());
window().target()->set_max_update_rate((get_refresh() == 0) ? get_origmode().RefreshRate : get_refresh());
}
if (m_shaders != nullptr)
diff --git a/src/osd/modules/render/drawgdi.cpp b/src/osd/modules/render/drawgdi.cpp
index 354d6950e30..ec1e5f57a4a 100644
--- a/src/osd/modules/render/drawgdi.cpp
+++ b/src/osd/modules/render/drawgdi.cpp
@@ -47,7 +47,7 @@ render_primitive_list *renderer_gdi::get_primitives()
{
RECT client;
GetClientRect(window().m_hwnd, &client);
- window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
+ window().target()->set_bounds(rect_width(&client), rect_height(&client), window().pixel_aspect());
return &window().target()->get_primitives();
}
diff --git a/src/osd/modules/render/drawnone.cpp b/src/osd/modules/render/drawnone.cpp
index 5e1b4aa05dd..d266369e7a6 100644
--- a/src/osd/modules/render/drawnone.cpp
+++ b/src/osd/modules/render/drawnone.cpp
@@ -23,6 +23,6 @@ render_primitive_list *renderer_none::get_primitives()
{
RECT client;
GetClientRect(window().m_hwnd, &client);
- window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
+ window().target()->set_bounds(rect_width(&client), rect_height(&client), window().pixel_aspect());
return &window().target()->get_primitives();
}
diff --git a/src/osd/modules/render/drawogl.h b/src/osd/modules/render/drawogl.h
index 3d3d3235e6e..69cd576c32d 100644
--- a/src/osd/modules/render/drawogl.h
+++ b/src/osd/modules/render/drawogl.h
@@ -141,17 +141,13 @@ public:
#endif
virtual render_primitive_list *get_primitives() override
{
-#ifdef OSD_WINDOWS
osd_dim nd = window().get_size();
-#else
- osd_dim nd = window().blit_surface_size();
-#endif
if (nd != m_blit_dim)
{
m_blit_dim = nd;
notify_changed();
}
- window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect());
+ window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().pixel_aspect());
return &window().target()->get_primitives();
}
diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp
index 005d523cf9a..932f88acc2b 100644
--- a/src/osd/modules/render/drawsdl.cpp
+++ b/src/osd/modules/render/drawsdl.cpp
@@ -672,12 +672,12 @@ static void yuv_RGB_to_YUY2X2(const UINT16 *bitmap, UINT8 *ptr, const int pitch,
render_primitive_list *renderer_sdl2::get_primitives()
{
- osd_dim nd = window().blit_surface_size();
+ osd_dim nd = window().get_size();
if (nd != m_blit_dim)
{
m_blit_dim = nd;
notify_changed();
}
- window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect());
+ window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().pixel_aspect());
return &window().target()->get_primitives();
}
diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp
index 3df00d90078..1ea3d283a29 100644
--- a/src/osd/sdl/video.cpp
+++ b/src/osd/sdl/video.cpp
@@ -124,22 +124,6 @@ void sdl_monitor_info::refresh()
m_is_primary = (m_handle == 0);
}
-//============================================================
-// sdlvideo_monitor_get_aspect
-//============================================================
-
-float osd_monitor_info::aspect()
-{
- // FIXME: returning 0 looks odd, video_config is bad
- if (video_config.keepaspect)
- {
- return m_aspect / ((float)m_pos_size.width() / (float)m_pos_size.height());
- }
- return 0.0f;
-}
-
-
-
//============================================================
// update
@@ -305,13 +289,6 @@ static void check_osd_inputs(running_machine &machine)
}
}
- if (machine.ui_input().pressed(IPT_OSD_2))
- {
- //FIXME: on a per window basis
- video_config.fullstretch = !video_config.fullstretch;
- machine.ui().popup_time(1, "Uneven stretch %s", video_config.fullstretch? "enabled":"disabled");
- }
-
if (machine.ui_input().pressed(IPT_OSD_4))
{
//FIXME: on a per window basis
@@ -351,7 +328,6 @@ void sdl_osd_interface::extract_video_config()
video_config.filter = options().filter();
video_config.keepaspect = options().keep_aspect();
video_config.numscreens = options().numscreens();
- video_config.fullstretch = options().uneven_stretch();
#ifdef SDLMAME_X11
video_config.restrictonemonitor = !options().use_all_heads();
#endif
diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp
index 1ca6e9605a6..c2d86858bf9 100644
--- a/src/osd/sdl/window.cpp
+++ b/src/osd/sdl/window.cpp
@@ -389,94 +389,6 @@ void sdl_osd_interface::window_exit()
//============================================================
-// sdlwindow_blit_surface_size
-//============================================================
-
-static inline int better_mode(int width0, int height0, int width1, int height1, float desired_aspect)
-{
- float aspect0 = (float)width0 / (float)height0;
- float aspect1 = (float)width1 / (float)height1;
- return (fabs(desired_aspect - aspect0) < fabs(desired_aspect - aspect1)) ? 0 : 1;
-}
-
-osd_dim sdl_window_info::blit_surface_size()
-{
- osd_dim window_dim = get_size();
-
- int newwidth, newheight;
- int xscale = 1, yscale = 1;
- float desired_aspect = 1.0f;
- INT32 target_width = window_dim.width();
- INT32 target_height = window_dim.height();
-
- // start with the minimum size
- m_target->compute_minimum_size(newwidth, newheight);
-
- // compute the appropriate visible area if we're trying to keepaspect
- if (video_config.keepaspect)
- {
- // make sure the monitor is up-to-date
- m_target->compute_visible_area(target_width, target_height, m_monitor->aspect(), m_target->orientation(), target_width, target_height);
- desired_aspect = (float)target_width / (float)target_height;
- }
-
- // non-integer scaling - often gives more pleasing results in full screen
- if (!video_config.fullstretch)
- {
- // compute maximum integral scaling to fit the window
- xscale = (target_width + 2) / newwidth;
- yscale = (target_height + 2) / newheight;
-
- // try a little harder to keep the aspect ratio if desired
- if (video_config.keepaspect)
- {
- // if we could stretch more in the X direction, and that makes a better fit, bump the xscale
- while (newwidth * (xscale + 1) <= window_dim.width() &&
- better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale + 1), newheight * yscale, desired_aspect))
- xscale++;
-
- // if we could stretch more in the Y direction, and that makes a better fit, bump the yscale
- while (newheight * (yscale + 1) <= window_dim.height() &&
- better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale + 1), desired_aspect))
- yscale++;
-
- // now that we've maxed out, see if backing off the maximally stretched one makes a better fit
- if (window_dim.width() - newwidth * xscale < window_dim.height() - newheight * yscale)
- {
- while (better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale - 1), newheight * yscale, desired_aspect) && (xscale >= 0))
- xscale--;
- }
- else
- {
- while (better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale - 1), desired_aspect) && (yscale >= 0))
- yscale--;
- }
- }
-
- // ensure at least a scale factor of 1
- if (xscale <= 0) xscale = 1;
- if (yscale <= 0) yscale = 1;
-
- // apply the final scale
- newwidth *= xscale;
- newheight *= yscale;
- }
- else
- {
- newwidth = target_width;
- newheight = target_height;
- }
-
- //FIXME: really necessary to distinguish for yuv_modes ?
- if (m_target->zoom_to_screen()
- && (video_config.scale_mode == VIDEO_SCALE_MODE_NONE ))
- newwidth = window_dim.width();
-
- return osd_dim(newwidth, newheight);
-}
-
-
-//============================================================
// sdlwindow_resize
// (main thread)
//============================================================
@@ -1007,27 +919,10 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt )
// if we have a remembered size force the new window size to it
temp = window->m_windowed_dim;
}
+ else if (window->m_startmaximized)
+ temp = window->get_max_bounds(video_config.keepaspect );
else
- {
- if (window->m_startmaximized)
- {
- temp = window->get_max_bounds(video_config.keepaspect );
- }
- else
- {
-#if 0
- // Couriersud: This code never has worked with the last version of get_min_bounds
- /* Create the window directly with the correct aspect
- instead of letting sdlwindow_blit_surface_size() resize it
- this stops the window from "flashing" from the wrong aspect
- size to the right one at startup. */
- tempwidth = (window->m_win_config.width != 0) ? window->m_win_config.width : 640;
- tempheight = (window->m_win_config.height != 0) ? window->m_win_config.height : 480;
-#endif
- temp = window->get_min_bounds(video_config.keepaspect );
- }
- }
-
+ temp = window->get_min_bounds(video_config.keepaspect );
// create the window .....
@@ -1069,9 +964,14 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt )
#if defined(SDLMAME_WIN32)
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
#endif
+
+ // get monitor work area for centering
+ osd_rect work = window->monitor()->usuable_position_size();
+
// create the SDL window
window->m_sdl_window = SDL_CreateWindow(window->m_title,
- window->monitor()->position_size().left(), window->monitor()->position_size().top(),
+ work.left() + (work.width() - temp.width()) / 2,
+ work.top() + (work.height() - temp.height()) / 2,
temp.width(), temp.height(), window->m_extra_flags);
//window().sdl_window() = SDL_CreateWindow(window().m_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
// width, height, m_extra_flags);
@@ -1134,7 +1034,12 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt )
}
}
}
+
+ // update monitor resolution after mode change to ensure proper pixel aspect
window->monitor()->refresh();
+ if (window->fullscreen() && video_config.switchres)
+ window->monitor()->update_resolution(temp.width(), temp.height());
+
// initialize the drawing backend
if (window->renderer().create())
return (void *) &result[1];
@@ -1286,8 +1191,12 @@ osd_rect sdl_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
float pixel_aspect;
osd_monitor_info *monitor = m_monitor;
+ // do not constrain aspect ratio for integer scaled views
+ if (m_target->current_view()->bounds().scale_type != RENDER_SCALE_FRACTIONAL)
+ return rect;
+
// get the pixel aspect ratio for the target monitor
- pixel_aspect = monitor->aspect();
+ pixel_aspect = monitor->pixel_aspect();
// determine the proposed width/height
propwidth = rect.width() - extrawidth;
@@ -1407,7 +1316,7 @@ osd_dim sdl_window_info::get_min_bounds(int constrain)
minheight += wnd_extra_height();
// if we want it constrained, figure out which one is larger
- if (constrain)
+ if (constrain && m_target->current_view()->bounds().scale_type == RENDER_SCALE_FRACTIONAL)
{
// first constrain with no height limit
osd_rect test1(0,0,minwidth,10000);
@@ -1471,11 +1380,11 @@ osd_dim sdl_window_info::get_max_bounds(int constrain)
maximum = maximum.resize(tempw, temph);
// constrain to fit
- if (constrain)
+ if (constrain && m_target->current_view()->bounds().scale_type == RENDER_SCALE_FRACTIONAL)
maximum = constrain_to_aspect_ratio(maximum, WMSZ_BOTTOMRIGHT);
- else
- {
- maximum = maximum.resize(maximum.width() - wnd_extra_width(), maximum.height() - wnd_extra_height());
- }
+
+ // remove extra window stuff
+ maximum = maximum.resize(maximum.width() - wnd_extra_width(), maximum.height() - wnd_extra_height());
+
return maximum.dim();
}
diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h
index 6cb2a497ebb..eeb51700630 100644
--- a/src/osd/sdl/window.h
+++ b/src/osd/sdl/window.h
@@ -85,7 +85,6 @@ public:
render_target *target() override { return m_target; }
SDL_Window *sdl_window() override { return m_sdl_window; }
- osd_dim blit_surface_size() override;
int prescale() const { return m_prescale; }
// Pointer to next window
diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp
index a90ed28ac21..559213657da 100644
--- a/src/osd/windows/video.cpp
+++ b/src/osd/windows/video.cpp
@@ -153,20 +153,6 @@ void win_monitor_info::refresh()
//============================================================
-// sdlvideo_monitor_get_aspect
-//============================================================
-
-float osd_monitor_info::aspect()
-{
- // FIXME: returning 0 looks odd, video_config is bad
- if (video_config.keepaspect)
- {
- return m_aspect / ((float)m_pos_size.width() / (float)m_pos_size.height());
- }
- return 0.0f;
-}
-
-//============================================================
// winvideo_monitor_from_handle
//============================================================
@@ -369,7 +355,6 @@ void windows_osd_interface::extract_video_config()
video_config.filter = options().filter();
video_config.keepaspect = options().keep_aspect();
video_config.numscreens = options().numscreens();
- video_config.fullstretch = options().uneven_stretch();
// if we are in debug mode, never go full screen
if (machine().debug_flags & DEBUG_FLAG_OSD_ENABLED)
diff --git a/src/osd/windows/video.h b/src/osd/windows/video.h
index e3c895c1726..9e040d90b78 100644
--- a/src/osd/windows/video.h
+++ b/src/osd/windows/video.h
@@ -64,8 +64,6 @@ struct osd_video_config
int syncrefresh; // sync only to refresh rate
int switchres; // switch resolutions
- int fullstretch; // FXIME: implement in windows!
-
// d3d, accel, opengl
int filter; // enable filtering
//int filter; // enable filtering, disabled if glsl_filter>0
diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp
index db8330cc858..c6fd834b17f 100644
--- a/src/osd/windows/window.cpp
+++ b/src/osd/windows/window.cpp
@@ -1581,6 +1581,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR
* should be used.
*/
window->m_monitor->refresh();
+ window->m_monitor->update_resolution(LOWORD(lparam), HIWORD(lparam));
break;
// set focus: if we're not the primary window, switch back
@@ -1642,13 +1643,6 @@ void win_window_info::draw_video_contents(HDC dc, int update)
}
-static inline int better_mode(int width0, int height0, int width1, int height1, float desired_aspect)
-{
- float aspect0 = (float)width0 / (float)height0;
- float aspect1 = (float)width1 / (float)height1;
- return (fabs(desired_aspect - aspect0) < fabs(desired_aspect - aspect1)) ? 0 : 1;
-}
-
//============================================================
// constrain_to_aspect_ratio
// (window thread)
@@ -1661,19 +1655,19 @@ osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
INT32 propwidth, propheight;
INT32 minwidth, minheight;
INT32 maxwidth, maxheight;
+ INT32 viswidth, visheight;
INT32 adjwidth, adjheight;
- float desired_aspect = 1.0f;
- osd_dim window_dim = get_size();
- INT32 target_width = window_dim.width();
- INT32 target_height = window_dim.height();
- INT32 xscale = 1, yscale = 1;
- int newwidth, newheight;
+ float pixel_aspect;
osd_monitor_info *monitor = winwindow_video_window_monitor(&rect);
assert(GetCurrentThreadId() == window_threadid);
+ // do not constrain aspect ratio for integer scaled views
+ if (m_target->current_view()->bounds().scale_type != RENDER_SCALE_FRACTIONAL)
+ return rect;
+
// get the pixel aspect ratio for the target monitor
- float pixel_aspect = monitor->aspect();
+ pixel_aspect = monitor->pixel_aspect();
// determine the proposed width/height
propwidth = rect.width() - extrawidth;
@@ -1701,58 +1695,6 @@ osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
// get the minimum width/height for the current layout
m_target->compute_minimum_size(minwidth, minheight);
- // compute the appropriate visible area if we're trying to keepaspect
- if (video_config.keepaspect)
- {
- // make sure the monitor is up-to-date
- m_target->compute_visible_area(target_width, target_height, m_monitor->aspect(), m_target->orientation(), target_width, target_height);
- desired_aspect = (float)target_width / (float)target_height;
- }
-
- // non-integer scaling - often gives more pleasing results in full screen
- newwidth = target_width;
- newheight = target_height;
- if (!video_config.fullstretch)
- {
- // compute maximum integral scaling to fit the window
- xscale = (target_width + 2) / newwidth;
- yscale = (target_height + 2) / newheight;
-
- // try a little harder to keep the aspect ratio if desired
- if (video_config.keepaspect)
- {
- // if we could stretch more in the X direction, and that makes a better fit, bump the xscale
- while (newwidth * (xscale + 1) <= window_dim.width() &&
- better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale + 1), newheight * yscale, desired_aspect))
- xscale++;
-
- // if we could stretch more in the Y direction, and that makes a better fit, bump the yscale
- while (newheight * (yscale + 1) <= window_dim.height() &&
- better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale + 1), desired_aspect))
- yscale++;
-
- // now that we've maxed out, see if backing off the maximally stretched one makes a better fit
- if (window_dim.width() - newwidth * xscale < window_dim.height() - newheight * yscale)
- {
- while (better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale - 1), newheight * yscale, desired_aspect) && (xscale >= 0))
- xscale--;
- }
- else
- {
- while (better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale - 1), desired_aspect) && (yscale >= 0))
- yscale--;
- }
- }
-
- // ensure at least a scale factor of 1
- if (xscale <= 0) xscale = 1;
- if (yscale <= 0) yscale = 1;
-
- // apply the final scale
- newwidth *= xscale;
- newheight *= yscale;
- }
-
// clamp against the absolute minimum
propwidth = MAX(propwidth, MIN_WINDOW_DIM);
propheight = MAX(propheight, MIN_WINDOW_DIM);
@@ -1783,9 +1725,12 @@ osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
propwidth = MIN(propwidth, maxwidth);
propheight = MIN(propheight, maxheight);
+ // compute the visible area based on the proposed rectangle
+ m_target->compute_visible_area(propwidth, propheight, pixel_aspect, m_target->orientation(), viswidth, visheight);
+
// compute the adjustments we need to make
- adjwidth = (propwidth + extrawidth) - rect.width();
- adjheight = (propheight + extraheight) - rect.height();
+ adjwidth = (viswidth + extrawidth) - rect.width();
+ adjheight = (visheight + extraheight) - rect.height();
// based on which corner we're adjusting, constrain in different ways
osd_rect ret(rect);
@@ -1812,7 +1757,6 @@ osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
ret = rect.move_by(0, -adjheight).resize(rect.width() + adjwidth, rect.height() + adjheight);
break;
}
-
return ret;
}
@@ -1843,7 +1787,7 @@ osd_dim win_window_info::get_min_bounds(int constrain)
minheight += wnd_extra_height();
// if we want it constrained, figure out which one is larger
- if (constrain)
+ if (constrain && m_target->current_view()->bounds().scale_type == RENDER_SCALE_FRACTIONAL)
{
// first constrain with no height limit
osd_rect test1(0,0,minwidth,10000);
@@ -1903,15 +1847,9 @@ osd_dim win_window_info::get_max_bounds(int constrain)
maximum = maximum.resize(tempw, temph);
// constrain to fit
- if (constrain)
- {
+ if (constrain && m_target->current_view()->bounds().scale_type == RENDER_SCALE_FRACTIONAL)
maximum = constrain_to_aspect_ratio(maximum, WMSZ_BOTTOMRIGHT);
- }
- else
- {
- // No - the maxima returned by usable_position_size are in window units, not usable units
- //maximum = maximum.resize(maximum.width() - wnd_extra_width(), maximum.height() - wnd_extra_height());
- }
+
return maximum.dim();
}
diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp
index 3a29e5f19ec..5638628d121 100644
--- a/src/osd/windows/winmain.cpp
+++ b/src/osd/windows/winmain.cpp
@@ -275,10 +275,6 @@ const options_entry windows_options::s_option_entries[] =
{ nullptr, nullptr, OPTION_HEADER, "WINDOWS VIDEO OPTIONS" },
{ WINOPTION_MENU, "0", OPTION_BOOLEAN, "enables menu bar if available by UI implementation" },
- // DirectDraw-specific options
- { nullptr, nullptr, OPTION_HEADER, "DIRECTDRAW-SPECIFIC OPTIONS" },
- { WINOPTION_HWSTRETCH ";hws", "1", OPTION_BOOLEAN, "enables hardware stretching" },
-
// post-processing options
{ nullptr, nullptr, OPTION_HEADER, "DIRECT3D POST-PROCESSING OPTIONS" },
{ WINOPTION_HLSL_ENABLE";hlsl", "0", OPTION_BOOLEAN, "enables HLSL post-processing (PS3.0 required)" },
diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h
index 8b6bf3baf1e..45c93b66c49 100644
--- a/src/osd/windows/winmain.h
+++ b/src/osd/windows/winmain.h
@@ -25,9 +25,6 @@
// video options
#define WINOPTION_MENU "menu"
-// DirectDraw-specific options
-#define WINOPTION_HWSTRETCH "hwstretch"
-
// core post-processing options
#define WINOPTION_HLSL_ENABLE "hlsl_enable"
#define WINOPTION_HLSLPATH "hlslpath"
@@ -128,9 +125,6 @@ public:
// video options
bool menu() const { return bool_value(WINOPTION_MENU); }
- // DirectDraw-specific options
- bool hwstretch() const { return bool_value(WINOPTION_HWSTRETCH); }
-
// core post-processing options
const char *screen_post_fx_dir() const { return value(WINOPTION_HLSLPATH); }
bool d3d_hlsl_enable() const { return bool_value(WINOPTION_HLSL_ENABLE); }