summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-02-27 01:42:50 +0100
committer couriersud <couriersud@arcor.de>2015-02-27 01:42:50 +0100
commit50d7d0f8ada64fc65cd1c286894bbd69cc414bb0 (patch)
tree2e23d31d58c8ab81cf15f95a6e12b03b23cdc3e4
parentdae49b998a41caaac33f3640dd8036b0029ec6b5 (diff)
Fixed windows baseline build.
More osd_dim use. (nw)
-rw-r--r--src/osd/modules/osdwindow.h2
-rw-r--r--src/osd/sdl/draw13.c22
-rw-r--r--src/osd/sdl/drawogl.c30
-rw-r--r--src/osd/sdl/drawsdl.c48
-rw-r--r--src/osd/sdl/video.h5
-rw-r--r--src/osd/sdl/window.c25
-rw-r--r--src/osd/sdl/window.h10
-rw-r--r--src/osd/windows/video.h2
-rw-r--r--src/osd/windows/window.c14
-rw-r--r--src/osd/windows/window.h7
10 files changed, 79 insertions, 86 deletions
diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h
index c9fdf908248..3edb10f997e 100644
--- a/src/osd/modules/osdwindow.h
+++ b/src/osd/modules/osdwindow.h
@@ -54,7 +54,7 @@ public:
virtual osd_dim get_size() = 0;
#ifdef OSD_SDL
- virtual void blit_surface_size(int &blitwidth, int &blitheight) = 0;
+ virtual osd_dim blit_surface_size() = 0;
virtual sdl_monitor_info *monitor() const = 0;
#if (SDLMAME_SDL2)
virtual SDL_Window *sdl_window() = 0;
diff --git a/src/osd/sdl/draw13.c b/src/osd/sdl/draw13.c
index c3231940f5c..d37b56333c8 100644
--- a/src/osd/sdl/draw13.c
+++ b/src/osd/sdl/draw13.c
@@ -146,7 +146,7 @@ public:
: osd_renderer(w, FLAG_NONE), m_blittimer(0), m_sdl_renderer(NULL),
m_last_hofs(0), m_last_vofs(0),
m_width(0), m_height(0),
- m_blitwidth(0), m_blitheight(0),
+ m_blit_dim(0,0),
m_last_blit_time(0), m_last_blit_pixels(0)
{}
@@ -156,14 +156,13 @@ public:
/* virtual */ void destroy();
/* virtual */ render_primitive_list *get_primitives()
{
- int nw = 0; int nh = 0;
- window().blit_surface_size(nw, nh);
- if (nw != m_blitwidth || nh != m_blitheight)
+ osd_dim nd = window().blit_surface_size();
+ if (nd != m_blit_dim)
{
- m_blitwidth = nw; m_blitheight = nh;
+ m_blit_dim = nd;
notify_changed();
}
- window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
+ window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect());
return &window().target()->get_primitives();
}
@@ -193,8 +192,7 @@ private:
int m_width;
int m_height;
- int m_blitwidth;
- int m_blitheight;
+ osd_dim m_blit_dim;
// Stats
INT64 m_last_blit_time;
@@ -649,9 +647,9 @@ int sdl_info13::xy_to_render_target(int x, int y, int *xt, int *yt)
{
*xt = x - m_last_hofs;
*yt = y - m_last_vofs;
- if (*xt<0 || *xt >= m_blitwidth)
+ if (*xt<0 || *xt >= m_blit_dim.width())
return 0;
- if (*yt<0 || *yt >= m_blitheight)
+ if (*yt<0 || *yt >= m_blit_dim.height())
return 0;
return 1;
}
@@ -724,11 +722,11 @@ int sdl_info13::draw(int update)
if (video_config.centerv)
{
- vofs = (ch - m_blitheight) / 2.0f;
+ vofs = (ch - m_blit_dim.height()) / 2.0f;
}
if (video_config.centerh)
{
- hofs = (cw - m_blitwidth) / 2.0f;
+ hofs = (cw - m_blit_dim.width()) / 2.0f;
}
}
diff --git a/src/osd/sdl/drawogl.c b/src/osd/sdl/drawogl.c
index d6b509b94cf..c22913b0314 100644
--- a/src/osd/sdl/drawogl.c
+++ b/src/osd/sdl/drawogl.c
@@ -487,7 +487,7 @@ public:
sdl_info_ogl(osd_window *window)
: osd_renderer(window, FLAG_NEEDS_OPENGL), m_blittimer(0),
m_width(0), m_height(0),
- m_blitwidth(0), m_blitheight(0),
+ m_blit_dim(0, 0),
m_gl_context(NULL),
m_initialized(0),
m_last_blendmode(0),
@@ -519,18 +519,17 @@ public:
/* virtual */ void destroy();
/* virtual */ render_primitive_list *get_primitives()
{
- int nw = 0; int nh = 0;
#ifdef OSD_WINDOWS
- window().get_size(nw, nh);
+ osd_dim nd = window().get_size();
#else
- window().blit_surface_size(nw, nh);
+ osd_dim nd = window().blit_surface_size();
#endif
- if (nw != m_blitwidth || nh != m_blitheight)
+ if (nd != m_blit_dim)
{
- m_blitwidth = nw; m_blitheight = nh;
+ m_blit_dim = nd;
notify_changed();
}
- window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
+ window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect());
return &window().target()->get_primitives();
}
@@ -562,8 +561,7 @@ private:
INT32 m_blittimer;
int m_width;
int m_height;
- int m_blitwidth;
- int m_blitheight;
+ osd_dim m_blit_dim;
osd_gl_context *m_gl_context;
@@ -1070,9 +1068,9 @@ int sdl_info_ogl::xy_to_render_target(int x, int y, int *xt, int *yt)
{
*xt = x - m_last_hofs;
*yt = y - m_last_vofs;
- if (*xt<0 || *xt >= m_blitwidth)
+ if (*xt<0 || *xt >= m_blit_dim.width())
return 0;
- if (*yt<0 || *yt >= m_blitheight)
+ if (*yt<0 || *yt >= m_blit_dim.height())
return 0;
return 1;
}
@@ -1612,11 +1610,11 @@ int sdl_info_ogl::draw(const int update)
if (video_config.centerv)
{
- vofs = (ch - m_blitheight) / 2.0f;
+ vofs = (ch - m_blit_dim.height()) / 2.0f;
}
if (video_config.centerh)
{
- hofs = (cw - m_blitwidth) / 2.0f;
+ hofs = (cw - m_blit_dim.width()) / 2.0f;
}
}
#else
@@ -2185,8 +2183,8 @@ int sdl_info_ogl::texture_shader_create(const render_texinfo *texsource, texture
{
int uniform_location;
int i;
- int surf_w_pow2 = get_valid_pow2_value (m_blitwidth, texture->texpow2);
- int surf_h_pow2 = get_valid_pow2_value (m_blitheight, texture->texpow2);
+ int surf_w_pow2 = get_valid_pow2_value (m_blit_dim.width(), texture->texpow2);
+ int surf_h_pow2 = get_valid_pow2_value (m_blit_dim.height(), texture->texpow2);
assert ( texture->type==TEXTURE_TYPE_SHADER );
@@ -2233,7 +2231,7 @@ int sdl_info_ogl::texture_shader_create(const render_texinfo *texsource, texture
pfn_glUniform2fvARB(uniform_location, 1, &(color_texture_pow2_sz[0]));
GL_CHECK_ERROR_NORMAL();
- GLfloat screen_texture_sz[2] = { (GLfloat) m_blitwidth, (GLfloat) m_blitheight };
+ GLfloat screen_texture_sz[2] = { (GLfloat) m_blit_dim.width(), (GLfloat) m_blit_dim.height() };
uniform_location = pfn_glGetUniformLocationARB(m_glsl_program[i], "screen_texture_sz");
pfn_glUniform2fvARB(uniform_location, 1, &(screen_texture_sz[0]));
GL_CHECK_ERROR_NORMAL();
diff --git a/src/osd/sdl/drawsdl.c b/src/osd/sdl/drawsdl.c
index 1d544c2d55e..453a139702f 100644
--- a/src/osd/sdl/drawsdl.c
+++ b/src/osd/sdl/drawsdl.c
@@ -64,10 +64,8 @@ public:
//m_hw_scale_height(0),
m_last_hofs(0),
m_last_vofs(0),
- m_blitwidth(0),
- m_blitheight(0),
- m_last_width(0),
- m_last_height(0)
+ m_blit_dim(0, 0),
+ m_last_dim(0, 0)
{ }
/* virtual */ int create();
@@ -76,14 +74,13 @@ public:
/* virtual */ void destroy();
/* virtual */ render_primitive_list *get_primitives()
{
- int nw = 0; int nh = 0;
- window().blit_surface_size(nw, nh);
- if (nw != m_blitwidth || nh != m_blitheight)
+ osd_dim nd = window().blit_surface_size();
+ if (nd != m_blit_dim)
{
- m_blitwidth = nw; m_blitheight = nh;
+ m_blit_dim = nd;
notify_changed();
}
- window().target()->set_bounds(m_blitwidth, m_blitheight, window().aspect());
+ window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect());
return &window().target()->get_primitives();
}
@@ -91,7 +88,7 @@ private:
void destroy_all_textures();
void yuv_init();
#if (SDLMAME_SDL2)
- void setup_texture(int tempwidth, int tempheight);
+ void setup_texture(const osd_dim &size);
#endif
void yuv_lookup_set(unsigned int pen, unsigned char red,
unsigned char green, unsigned char blue);
@@ -118,10 +115,8 @@ private:
int m_last_hofs;
int m_last_vofs;
- int m_blitwidth;
- int m_blitheight;
- int m_last_width;
- int m_last_height;
+ osd_dim m_blit_dim;
+ osd_dim m_last_dim;
};
struct sdl_scale_mode
@@ -269,7 +264,7 @@ static void drawsdl_exit(void)
//============================================================
#if (SDLMAME_SDL2)
-void sdl_info::setup_texture(int tempwidth, int tempheight)
+void sdl_info::setup_texture(const osd_dim &size)
{
const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode];
SDL_DisplayMode mode;
@@ -288,7 +283,7 @@ void sdl_info::setup_texture(int tempwidth, int tempheight)
if (sdl_sm->is_scale)
{
- int m_hw_scale_width =0;
+ int m_hw_scale_width = 0;
int m_hw_scale_height = 0;
window().target()->compute_minimum_size(m_hw_scale_width, m_hw_scale_height);
@@ -312,7 +307,7 @@ void sdl_info::setup_texture(int tempwidth, int tempheight)
else
{
m_texture_id = SDL_CreateTexture(m_sdl_renderer,fmt, SDL_TEXTUREACCESS_STREAMING,
- tempwidth, tempheight);
+ size.width(), size.height());
}
}
#endif
@@ -523,9 +518,9 @@ int sdl_info::xy_to_render_target(int x, int y, int *xt, int *yt)
{
*xt = x - m_last_hofs;
*yt = y - m_last_vofs;
- if (*xt<0 || *xt >= m_blitwidth)
+ if (*xt<0 || *xt >= m_blit_dim.width())
return 0;
- if (*yt<0 || *yt >= m_blitheight)
+ if (*yt<0 || *yt >= m_blit_dim.height())
return 0;
return 1;
}
@@ -571,18 +566,17 @@ int sdl_info::draw(int update)
}
osd_dim wdim = window().get_size();
- if (has_flags(FI_CHANGED) || (wdim.width() != m_last_width) || (wdim.height() != m_last_height))
+ if (has_flags(FI_CHANGED) || (wdim != m_last_dim))
{
destroy_all_textures();
clear_flags(FI_CHANGED);
m_blittimer = 3;
- m_last_width = wdim.width();
- m_last_height = wdim.height();
+ m_last_dim = wdim;
#if (SDLMAME_SDL2)
SDL_RenderSetViewport(m_sdl_renderer, NULL);
if (m_texture_id != NULL)
SDL_DestroyTexture(m_texture_id);
- setup_texture(m_blitwidth, m_blitheight);
+ setup_texture(m_blit_dim);
m_blittimer = 3;
#else
const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode];
@@ -665,8 +659,8 @@ int sdl_info::draw(int update)
#endif
// get ready to center the image
vofs = hofs = 0;
- blitwidth = m_blitwidth;
- blitheight = m_blitheight;
+ blitwidth = m_blit_dim.width();
+ blitheight = m_blit_dim.height();
ch = wdim.height();
cw = wdim.width();
@@ -678,7 +672,7 @@ int sdl_info::draw(int update)
}
else if (video_config.centerv)
{
- vofs = (ch - m_blitheight) / 2;
+ vofs = (ch - m_blit_dim.height()) / 2;
}
if (blitwidth > cw)
@@ -687,7 +681,7 @@ int sdl_info::draw(int update)
}
else if (video_config.centerh)
{
- hofs = (cw - m_blitwidth) / 2;
+ hofs = (cw - m_blit_dim.width()) / 2;
}
m_last_hofs = hofs;
diff --git a/src/osd/sdl/video.h b/src/osd/sdl/video.h
index 68ae3d2f72d..9286ead12ec 100644
--- a/src/osd/sdl/video.h
+++ b/src/osd/sdl/video.h
@@ -69,6 +69,8 @@ public:
int width() const { return m_w; }
int height() const { return m_h; }
+ bool operator!=(const osd_dim &other) { return (m_w != other.width()) || (m_h != other.height()); }
+ bool operator==(const osd_dim &other) { return (m_w == other.width()) && (m_h == other.height()); }
private:
int m_w;
int m_h;
@@ -126,12 +128,13 @@ public:
const UINT64 handle() { return m_handle; }
const osd_rect position_size() { refresh(); return SDL_Rect_to_osd_rect(m_dimensions); }
+ const osd_rect usuable_position_size() { refresh(); return SDL_Rect_to_osd_rect(m_dimensions); }
const char *devicename() { refresh(); return m_name[0] ? m_name : "UNKNOWN"; }
float aspect();
- void set_aspect(const float aspect) { m_aspect = aspect; }
+ void set_aspect(const float a) { m_aspect = a; }
// STATIC
static void init();
diff --git a/src/osd/sdl/window.c b/src/osd/sdl/window.c
index b6dcffb758c..b52e81c6d77 100644
--- a/src/osd/sdl/window.c
+++ b/src/osd/sdl/window.c
@@ -382,7 +382,7 @@ INLINE int better_mode(int width0, int height0, int width1, int height1, float d
return (fabs(desired_aspect - aspect0) < fabs(desired_aspect - aspect1)) ? 0 : 1;
}
-void sdl_window_info::blit_surface_size(int &blitwidth, int &blitheight)
+osd_dim sdl_window_info::blit_surface_size()
{
osd_dim window_dim = get_size();
@@ -455,8 +455,7 @@ void sdl_window_info::blit_surface_size(int &blitwidth, int &blitheight)
&& (video_config.scale_mode == VIDEO_SCALE_MODE_NONE ))
newwidth = window_dim.width();
- blitwidth = newwidth;
- blitheight = newheight;
+ return osd_dim(newwidth, newheight);
}
@@ -735,7 +734,7 @@ int sdl_window_info::window_init()
m_target = m_machine.render().target_alloc();
// set the specific view
- set_starting_view(m_machine, m_index, options.view(), options.view(m_index));
+ set_starting_view(m_index, options.view(), options.view(m_index));
// make the window title
if (video_config.numscreens == 1)
@@ -1009,10 +1008,9 @@ void sdl_window_info::update()
// see if the games video mode has changed
m_target->compute_minimum_size(tempwidth, tempheight);
- if (tempwidth != m_minwidth || tempheight != m_minheight)
+ if (osd_dim(tempwidth, tempheight) != m_minimum_dim)
{
- m_minwidth = tempwidth;
- m_minheight = tempheight;
+ m_minimum_dim = osd_dim(tempwidth, tempheight);
if (!this->m_fullscreen)
{
@@ -1050,7 +1048,7 @@ void sdl_window_info::update()
// (main thread)
//============================================================
-void sdl_window_info::set_starting_view(running_machine &machine, int index, const char *defview, const char *view)
+void sdl_window_info::set_starting_view(int index, const char *defview, const char *view)
{
int viewindex;
@@ -1394,9 +1392,10 @@ osd_rect sdl_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
INT32 viswidth, visheight;
INT32 adjwidth, adjheight;
float pixel_aspect;
+ sdl_monitor_info *monitor = m_monitor;
// get the pixel aspect ratio for the target monitor
- pixel_aspect = m_monitor->aspect();
+ pixel_aspect = monitor->aspect();
// determine the proposed width/height
propwidth = rect.width() - extrawidth;
@@ -1435,13 +1434,13 @@ osd_rect sdl_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
// clamp against the maximum (fit on one screen for full screen mode)
if (m_fullscreen)
{
- maxwidth = m_monitor->position_size().width() - extrawidth;
- maxheight = m_monitor->position_size().height() - extraheight;
+ maxwidth = monitor->position_size().width() - extrawidth;
+ maxheight = monitor->position_size().height() - extraheight;
}
else
{
- maxwidth = m_monitor->position_size().width() - extrawidth;
- maxheight = m_monitor->position_size().height() - extraheight;
+ maxwidth = monitor->usuable_position_size().width() - extrawidth;
+ maxheight = monitor->usuable_position_size().height() - extraheight;
// further clamp to the maximum width/height in the window
if (m_win_config.width != 0)
diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h
index 8b1b87dc2e7..fe8ec9a7498 100644
--- a/src/osd/sdl/window.h
+++ b/src/osd/sdl/window.h
@@ -44,7 +44,7 @@ public:
m_resize_height(0),
m_last_resize(0),
#endif
- m_minwidth(0), m_minheight(0),
+ m_minimum_dim(0,0),
m_windowed_dim(0,0),
m_rendered_event(0), m_target(0),
#if (SDLMAME_SDL2)
@@ -104,7 +104,7 @@ public:
SDL_Surface *sdl_surface() { return m_sdlsurf; }
#endif
- void blit_surface_size(int &blitwidth, int &blitheight);
+ osd_dim blit_surface_size();
int prescale() const { return m_prescale; }
// Pointer to next window
@@ -122,8 +122,8 @@ private:
char m_title[256];
int m_startmaximized;
- // diverse flags
- int m_minwidth, m_minheight;
+ // dimensions
+ osd_dim m_minimum_dim;
osd_dim m_windowed_dim;
// rendering info
@@ -153,7 +153,7 @@ protected:
private:
int wnd_extra_width();
int wnd_extra_height();
- void set_starting_view(running_machine &machine, int index, const char *defview, const char *view);
+ void set_starting_view(int index, const char *defview, const char *view);
osd_rect constrain_to_aspect_ratio(const osd_rect &rect, int adjustment);
osd_dim get_min_bounds(int constrain);
osd_dim get_max_bounds(int constrain);
diff --git a/src/osd/windows/video.h b/src/osd/windows/video.h
index 44bca90b4e0..e82b6f41261 100644
--- a/src/osd/windows/video.h
+++ b/src/osd/windows/video.h
@@ -45,6 +45,8 @@ public:
int width() const { return m_w; }
int height() const { return m_h; }
+ bool operator!=(const osd_dim &other) { return (m_w != other.width()) || (m_h != other.height()); }
+ bool operator==(const osd_dim &other) { return (m_w == other.width()) && (m_h == other.height()); }
private:
int m_w;
int m_h;
diff --git a/src/osd/windows/window.c b/src/osd/windows/window.c
index f5875f8d583..9790e61d1ef 100644
--- a/src/osd/windows/window.c
+++ b/src/osd/windows/window.c
@@ -677,7 +677,9 @@ void win_window_info::create(running_machine &machine, int index, win_monitor_in
// set the specific view
windows_options &options = downcast<windows_options &>(machine.options());
- window->set_starting_view(index, options.view(index));
+
+ const char *defview = options.view();
+ window->set_starting_view(index, defview, options.view(index));
// remember the current values in case they change
window->m_targetview = window->m_target->view();
@@ -898,9 +900,8 @@ static void create_window_class(void)
// (main thread)
//============================================================
-void win_window_info::set_starting_view(int index, const char *view)
+void win_window_info::set_starting_view(int index, const char *defview, const char *view)
{
- const char *defview = downcast<windows_options &>(machine().options()).view();
int viewindex;
assert(GetCurrentThreadId() == main_threadid);
@@ -910,14 +911,13 @@ void win_window_info::set_starting_view(int index, const char *view)
view = defview;
// query the video system to help us pick a view
- viewindex = m_target->configured_view(view, index, video_config.numscreens);
+ viewindex = target()->configured_view(view, index, video_config.numscreens);
// set the view
- m_target->set_view(viewindex);
+ target()->set_view(viewindex);
}
-
//============================================================
// winwindow_ui_pause_from_main_thread
// (main thread)
@@ -1515,7 +1515,6 @@ void win_window_info::draw_video_contents(HDC dc, int update)
osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int adjustment)
{
- win_monitor_info *monitor = winwindow_video_window_monitor(&rect);
INT32 extrawidth = wnd_extra_width();
INT32 extraheight = wnd_extra_height();
INT32 propwidth, propheight;
@@ -1524,6 +1523,7 @@ osd_rect win_window_info::constrain_to_aspect_ratio(const osd_rect &rect, int ad
INT32 viswidth, visheight;
INT32 adjwidth, adjheight;
float pixel_aspect;
+ win_monitor_info *monitor = winwindow_video_window_monitor(&rect);
assert(GetCurrentThreadId() == window_threadid);
diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h
index 7b60c953bba..bb7fb779aa2 100644
--- a/src/osd/windows/window.h
+++ b/src/osd/windows/window.h
@@ -53,12 +53,11 @@ public:
return GetMenu(m_hwnd) ? true : false;
}
- /* virtual */ void get_size(int &w, int &h)
+ /* virtual */ osd_dim get_size()
{
RECT client;
GetClientRect(m_hwnd, &client);
- w = client.right - client.left;
- h = client.bottom - client.top;
+ return osd_dim(client.right - client.left, client.bottom - client.top);
}
win_monitor_info *monitor() const { return m_monitor; }
@@ -110,7 +109,7 @@ public:
private:
void draw_video_contents(HDC dc, int update);
int complete_create();
- void set_starting_view(int index, const char *view);
+ void set_starting_view(int index, const char *defview, const char *view);
int wnd_extra_width();
int wnd_extra_height();
osd_rect constrain_to_aspect_ratio(const osd_rect &rect, int adjustment);