mirror of
https://github.com/holub/mame
synced 2025-04-27 02:33:13 +03:00
More code alignment for windows and renderer. (nw)
This commit is contained in:
parent
14689ed98d
commit
1568bbccb7
@ -163,7 +163,7 @@ public:
|
||||
m_blitwidth = nw; m_blitheight = nh;
|
||||
notify_changed();
|
||||
}
|
||||
window().target()->set_bounds(m_blitwidth, m_blitheight, window().monitor()->aspect());
|
||||
window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
|
||||
return &window().target()->get_primitives();
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
m_blitwidth = nw; m_blitheight = nh;
|
||||
notify_changed();
|
||||
}
|
||||
window().target()->set_bounds(m_blitwidth, m_blitheight, window().monitor()->aspect());
|
||||
window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
|
||||
return &window().target()->get_primitives();
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ public:
|
||||
m_blitwidth = nw; m_blitheight = nh;
|
||||
notify_changed();
|
||||
}
|
||||
window().target()->set_bounds(m_blitwidth, m_blitheight, window().monitor()->aspect());
|
||||
window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
|
||||
return &window().target()->get_primitives();
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
m_blitwidth = nw; m_blitheight = nh;
|
||||
notify_changed();
|
||||
}
|
||||
window().target()->set_bounds(m_blitwidth, m_blitheight, window().monitor()->aspect());
|
||||
window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
|
||||
return &window().target()->get_primitives();
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,6 @@ void sdl_monitor_info::refresh()
|
||||
m_dimensions.h = xineinfo[0].height;
|
||||
|
||||
XFree(xineinfo);
|
||||
printf("XineneraActive\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
:
|
||||
#ifdef OSD_SDL
|
||||
#else
|
||||
m_hwnd(0), m_focus_hwnd(0), m_monitor(NULL), m_resize_state(0),
|
||||
m_hwnd(0), m_focus_hwnd(0), m_resize_state(0),
|
||||
m_maxwidth(0), m_maxheight(0),
|
||||
m_refresh(0),
|
||||
#endif
|
||||
@ -64,6 +64,8 @@ public:
|
||||
|
||||
int prescale() const { return m_prescale; };
|
||||
|
||||
float aspect() const { return monitor()->aspect(); }
|
||||
|
||||
#ifdef OSD_SDL
|
||||
virtual void blit_surface_size(int &blitwidth, int &blitheight) = 0;
|
||||
virtual sdl_monitor_info *monitor() const = 0;
|
||||
@ -74,7 +76,9 @@ public:
|
||||
virtual SDL_Surface *sdl_surface() = 0;
|
||||
#endif
|
||||
#else
|
||||
virtual win_monitor_info *monitor() const = 0;
|
||||
virtual bool win_has_menu() = 0;
|
||||
// FIXME: cann we replace winwindow_video_window_monitor(NULL) with monitor() ?
|
||||
virtual win_monitor_info *winwindow_video_window_monitor(const RECT *proposed) = 0;
|
||||
|
||||
// window handle and info
|
||||
@ -83,8 +87,6 @@ public:
|
||||
// During modularization, this should be passed in differently
|
||||
HWND m_focus_hwnd;
|
||||
|
||||
// monitor info
|
||||
win_monitor_info * m_monitor;
|
||||
int m_resize_state;
|
||||
int m_maxwidth, m_maxheight;
|
||||
int m_refresh;
|
||||
|
@ -124,7 +124,7 @@ render_primitive_list *renderer_bgfx::get_primitives()
|
||||
{
|
||||
RECT client;
|
||||
GetClientRect(window().m_hwnd, &client);
|
||||
window().target()->set_bounds(rect_width(&client), rect_height(&client), window().m_monitor->get_aspect());
|
||||
window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
|
||||
return &window().target()->get_primitives();
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ render_primitive_list *d3d::renderer::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().m_monitor->get_aspect());
|
||||
window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
|
||||
window().target()->set_max_update_rate((get_refresh() == 0) ? get_origmode().RefreshRate : get_refresh());
|
||||
}
|
||||
return &window().target()->get_primitives();
|
||||
@ -1220,12 +1220,7 @@ int renderer::config_adapter_mode()
|
||||
// make sure it's a pixel format we can get behind
|
||||
if (m_pixformat != D3DFMT_X1R5G5B5 && m_pixformat != D3DFMT_R5G6B5 && m_pixformat != D3DFMT_X8R8G8B8)
|
||||
{
|
||||
char *utf8_device = utf8_from_tstring(window().m_monitor->info.szDevice);
|
||||
if (utf8_device != NULL)
|
||||
{
|
||||
osd_printf_error("Device %s currently in an unsupported mode\n", utf8_device);
|
||||
osd_free(utf8_device);
|
||||
}
|
||||
osd_printf_error("Device %s currently in an unsupported mode\n", window().monitor()->devicename());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -1248,12 +1243,7 @@ int renderer::config_adapter_mode()
|
||||
result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !window().fullscreen());
|
||||
if (result != D3D_OK)
|
||||
{
|
||||
char *utf8_device = utf8_from_tstring(window().m_monitor->info.szDevice);
|
||||
if (utf8_device != NULL)
|
||||
{
|
||||
osd_printf_error("Proposed video mode not supported on device %s\n", utf8_device);
|
||||
osd_free(utf8_device);
|
||||
}
|
||||
osd_printf_error("Proposed video mode not supported on device %s\n", window().monitor()->devicename());
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -1276,7 +1266,7 @@ int renderer::get_adapter_for_monitor()
|
||||
HMONITOR curmonitor = (*d3dintf->d3d.get_adapter_monitor)(d3dintf, adapternum);
|
||||
|
||||
// if we match the proposed monitor, this is it
|
||||
if (curmonitor == window().m_monitor->handle)
|
||||
if (curmonitor == window().monitor()->handle)
|
||||
{
|
||||
return adapternum;
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ void renderer_dd::compute_blit_surface_size()
|
||||
if (video_config.keepaspect)
|
||||
{
|
||||
win_monitor_info *monitor = window().winwindow_video_window_monitor(NULL);
|
||||
window().target()->compute_visible_area(target_width, target_height, monitor->get_aspect(), window().target()->orientation(), target_width, target_height);
|
||||
window().target()->compute_visible_area(target_width, target_height, monitor->aspect(), window().target()->orientation(), target_width, target_height);
|
||||
desired_aspect = (float)target_width / (float)target_height;
|
||||
}
|
||||
|
||||
@ -1000,7 +1000,7 @@ void renderer_dd::blit_to_primary(int srcwidth, int srcheight)
|
||||
else if (video_config.keepaspect)
|
||||
{
|
||||
// compute the appropriate visible area
|
||||
window().target()->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->get_aspect(), window().target()->orientation(), dstwidth, dstheight);
|
||||
window().target()->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->aspect(), window().target()->orientation(), dstwidth, dstheight);
|
||||
}
|
||||
|
||||
// center within
|
||||
@ -1082,7 +1082,7 @@ int renderer_dd::config_adapter_mode()
|
||||
HRESULT result;
|
||||
|
||||
// choose the monitor number
|
||||
get_adapter_for_monitor(window().m_monitor);
|
||||
get_adapter_for_monitor(window().monitor());
|
||||
|
||||
// create a temporary DirectDraw object
|
||||
result = (*directdrawcreateex)(adapter_ptr, (LPVOID *)&ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
|
||||
|
@ -133,7 +133,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().m_monitor->get_aspect());
|
||||
window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
|
||||
return &window().target()->get_primitives();
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ 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().m_monitor->get_aspect());
|
||||
window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
|
||||
return &window().target()->get_primitives();
|
||||
}
|
||||
|
||||
|
@ -112,14 +112,17 @@ void windows_osd_interface::video_exit()
|
||||
win_monitor_info::win_monitor_info()
|
||||
: next(NULL),
|
||||
handle(NULL),
|
||||
aspect(0.0f),
|
||||
m_aspect(0.0f),
|
||||
reqwidth(0),
|
||||
reqheight(0)
|
||||
reqheight(0),
|
||||
m_name(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
win_monitor_info::~win_monitor_info()
|
||||
{
|
||||
if (m_name != NULL)
|
||||
osd_free(m_name);
|
||||
}
|
||||
|
||||
//============================================================
|
||||
@ -134,6 +137,9 @@ void win_monitor_info::refresh()
|
||||
info.cbSize = sizeof(info);
|
||||
result = GetMonitorInfo(handle, (LPMONITORINFO)&info);
|
||||
assert(result);
|
||||
if (m_name != NULL)
|
||||
osd_free(m_name);
|
||||
m_name = utf8_from_tstring(info.szDevice);
|
||||
(void)result; // to silence gcc 4.6
|
||||
}
|
||||
|
||||
@ -143,7 +149,7 @@ void win_monitor_info::refresh()
|
||||
// winvideo_monitor_get_aspect
|
||||
//============================================================
|
||||
|
||||
float win_monitor_info::get_aspect()
|
||||
float win_monitor_info::aspect()
|
||||
{
|
||||
// refresh the monitor information and compute the aspect
|
||||
if (video_config.keepaspect)
|
||||
@ -152,7 +158,7 @@ float win_monitor_info::get_aspect()
|
||||
refresh();
|
||||
width = rect_width(&info.rcMonitor);
|
||||
height = rect_height(&info.rcMonitor);
|
||||
return aspect / ((float)width / (float)height);
|
||||
return m_aspect / ((float)width / (float)height);
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
@ -219,12 +225,7 @@ static void init_monitors(void)
|
||||
win_monitor_info *monitor;
|
||||
for (monitor = win_monitor_list; monitor != NULL; monitor = monitor->next)
|
||||
{
|
||||
char *utf8_device = utf8_from_tstring(monitor->info.szDevice);
|
||||
if (utf8_device != NULL)
|
||||
{
|
||||
osd_printf_verbose("Video: Monitor %p = \"%s\" %s\n", monitor->handle, utf8_device, (monitor == primary_monitor) ? "(primary)" : "");
|
||||
osd_free(utf8_device);
|
||||
}
|
||||
osd_printf_verbose("Video: Monitor %p = \"%s\" %s\n", monitor->handle, monitor->devicename(), (monitor == primary_monitor) ? "(primary)" : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -298,17 +299,12 @@ static win_monitor_info *pick_monitor(windows_options &options, int index)
|
||||
if (scrname[0] != 0)
|
||||
for (monitor = win_monitor_list; monitor != NULL; monitor = monitor->next)
|
||||
{
|
||||
char *utf8_device;
|
||||
int rc = 1;
|
||||
|
||||
moncount++;
|
||||
|
||||
utf8_device = utf8_from_tstring(monitor->info.szDevice);
|
||||
if (utf8_device != NULL)
|
||||
{
|
||||
rc = strcmp(scrname, utf8_device);
|
||||
osd_free(utf8_device);
|
||||
}
|
||||
rc = strcmp(scrname, monitor->devicename());
|
||||
|
||||
if (rc == 0)
|
||||
goto finishit;
|
||||
}
|
||||
|
@ -37,22 +37,24 @@ public:
|
||||
virtual ~win_monitor_info();
|
||||
|
||||
void refresh();
|
||||
float get_aspect();
|
||||
void set_aspect(float a) { aspect = a; }
|
||||
float aspect();
|
||||
void set_aspect(float a) { m_aspect = a; }
|
||||
const char *devicename() { refresh(); return (m_name != NULL) ? m_name : "UNKNOWN"; }
|
||||
|
||||
win_monitor_info * next; // pointer to next monitor in list
|
||||
HMONITOR handle; // handle to the monitor
|
||||
MONITORINFOEX info; // most recently retrieved info
|
||||
private:
|
||||
float aspect; // computed/configured aspect ratio of the physical device
|
||||
float m_aspect; // computed/configured aspect ratio of the physical device
|
||||
int reqwidth; // requested width for this monitor
|
||||
int reqheight; // requested height for this monitor
|
||||
char * m_name;
|
||||
};
|
||||
|
||||
|
||||
struct win_window_config
|
||||
{
|
||||
float aspect; // decoded aspect ratio
|
||||
float aspect; // decoded aspect ratio FIXME:Not used!
|
||||
int width; // decoded width
|
||||
int height; // decoded height
|
||||
int refresh; // decoded refresh
|
||||
|
@ -302,6 +302,7 @@ win_window_info::win_window_info(running_machine &machine)
|
||||
m_startmaximized(0),
|
||||
m_isminimized(0),
|
||||
m_ismaximized(0),
|
||||
m_monitor(NULL),
|
||||
m_fullscreen(0),
|
||||
m_fullscreen_safe(0),
|
||||
m_aspect(0),
|
||||
@ -1521,7 +1522,7 @@ static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int a
|
||||
assert(GetCurrentThreadId() == window_threadid);
|
||||
|
||||
// get the pixel aspect ratio for the target monitor
|
||||
pixel_aspect = monitor->get_aspect();
|
||||
pixel_aspect = monitor->aspect();
|
||||
|
||||
// determine the proposed width/height
|
||||
propwidth = rect_width(rect) - extrawidth;
|
||||
|
@ -48,9 +48,8 @@ public:
|
||||
osd_window()
|
||||
:
|
||||
#ifdef OSD_SDL
|
||||
m_start_viewscreen(0),
|
||||
#else
|
||||
m_hwnd(0), m_focus_hwnd(0), m_monitor(NULL), m_resize_state(0),
|
||||
m_hwnd(0), m_focus_hwnd(0), m_resize_state(0),
|
||||
m_maxwidth(0), m_maxheight(0),
|
||||
m_refresh(0),
|
||||
#endif
|
||||
@ -65,6 +64,8 @@ public:
|
||||
|
||||
int prescale() const { return m_prescale; };
|
||||
|
||||
float aspect() const { return monitor()->aspect(); }
|
||||
|
||||
#ifdef OSD_SDL
|
||||
virtual void blit_surface_size(int &blitwidth, int &blitheight) = 0;
|
||||
virtual sdl_monitor_info *monitor() const = 0;
|
||||
@ -75,7 +76,9 @@ public:
|
||||
virtual SDL_Surface *sdl_surface() = 0;
|
||||
#endif
|
||||
#else
|
||||
virtual win_monitor_info *monitor() const = 0;
|
||||
virtual bool win_has_menu() = 0;
|
||||
// FIXME: cann we replace winwindow_video_window_monitor(NULL) with monitor() ?
|
||||
virtual win_monitor_info *winwindow_video_window_monitor(const RECT *proposed) = 0;
|
||||
|
||||
// window handle and info
|
||||
@ -84,8 +87,6 @@ public:
|
||||
// During modularization, this should be passed in differently
|
||||
HWND m_focus_hwnd;
|
||||
|
||||
// monitor info
|
||||
win_monitor_info * m_monitor;
|
||||
int m_resize_state;
|
||||
int m_maxwidth, m_maxheight;
|
||||
int m_refresh;
|
||||
@ -168,6 +169,8 @@ public:
|
||||
return GetMenu(m_hwnd) ? true : false;
|
||||
}
|
||||
|
||||
win_monitor_info *monitor() const { return m_monitor; }
|
||||
|
||||
win_window_info * m_next;
|
||||
volatile int m_init_state;
|
||||
|
||||
@ -179,6 +182,7 @@ public:
|
||||
int m_ismaximized;
|
||||
|
||||
// monitor info
|
||||
win_monitor_info * m_monitor;
|
||||
int m_fullscreen;
|
||||
int m_fullscreen_safe;
|
||||
float m_aspect;
|
||||
|
@ -590,10 +590,8 @@ void windows_osd_interface::init(running_machine &machine)
|
||||
astring tempstring;
|
||||
for (win_window_info *info = win_window_list; info != NULL; info = info->m_next)
|
||||
{
|
||||
char *tmp = utf8_from_tstring(info->m_monitor->info.szDevice);
|
||||
tempstring.printf("Orientation(%s)", tmp);
|
||||
tempstring.printf("Orientation(%s)", info->m_monitor->devicename());
|
||||
output_set_value(tempstring, info->m_targetorient);
|
||||
osd_free(tmp);
|
||||
}
|
||||
|
||||
// hook up the debugger log
|
||||
|
Loading…
Reference in New Issue
Block a user