Get rid of "resize" render method. (nw)

This commit is contained in:
couriersud 2015-02-06 01:13:55 +01:00
parent d936763e77
commit 984e40296b
6 changed files with 40 additions and 72 deletions

View File

@ -145,12 +145,11 @@ public:
sdl_info13(sdl_window_info *w)
: osd_renderer(w, FLAG_NONE), m_blittimer(0), m_sdl_renderer(NULL),
m_last_hofs(0), m_last_vofs(0),
m_resize_pending(0), m_resize_width(0), m_resize_height(0),
m_last_width(0), m_last_height(0),
m_last_blit_time(0), m_last_blit_pixels(0)
{}
/* virtual */ int create(const int width, const int height);
/* virtual */ void resize(const int width, const int height);
/* virtual */ int draw(const UINT32 dc, const int update);
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
/* virtual */ void destroy_all_textures();
@ -177,11 +176,8 @@ public:
float m_last_hofs;
float m_last_vofs;
// resize information
UINT8 m_resize_pending;
UINT32 m_resize_width;
UINT32 m_resize_height;
int m_last_width;
int m_last_height;
// Stats
INT64 m_last_blit_time;
@ -617,16 +613,6 @@ int sdl_info13::create(int width, int height)
return 0;
}
//============================================================
// sdl_info::resize
//============================================================
void sdl_info13::resize(int width, int height)
{
SDL_RenderSetViewport(m_sdl_renderer, NULL);
m_blittimer = 3;
}
//============================================================
// sdl_info::destroy
@ -695,17 +681,13 @@ int sdl_info13::draw(UINT32 dc, int update)
return 0;
}
#if 0
if (m_resize_pending)
if ((window().width() != m_last_width) || (window().height() != m_last_height))
{
SDL_SetWindowSize(window().m_sdl_window, m_resize_width, m_resize_height);
SDL_GetWindowSize(window().m_sdl_window, &window().width(), &window().height());
m_resize_pending = 0;
m_last_width = window().width();
m_last_height = window().height();
SDL_RenderSetViewport(m_sdl_renderer, NULL);
//sdlvideo_monitor_refresh(window().monitor());
m_blittimer = 3;
}
#endif
//SDL_SelectRenderer(window().sdl_window);
if (m_blittimer > 0)

View File

@ -80,7 +80,6 @@ public:
{}
/* virtual */ int create(const int width, const int height);
/* virtual */ void resize(const int width, const int height);
/* virtual */ int draw(const UINT32 dc, const int update);
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
/* virtual */ void destroy_all_textures();
@ -151,15 +150,6 @@ int sdl_info_bgfx::create(int width, int height)
return 0;
}
//============================================================
// sdl_info_bgfx::resize
//============================================================
void sdl_info_bgfx::resize(int width, int height)
{
m_blittimer = 3;
}
//============================================================
// drawsdl_xy_to_render_target
//============================================================

View File

@ -224,6 +224,7 @@ public:
sdl_info_ogl(sdl_window_info *window)
: osd_renderer(window, FLAG_NEEDS_OPENGL), m_blittimer(0),
m_screen_width(0), m_screen_height(0),
m_last_width(0), m_last_height(0),
#if (SDLMAME_SDL2)
m_gl_context_id(0),
#else
@ -252,7 +253,6 @@ public:
}
/* virtual */ int create(const int width, const int height);
/* virtual */ void resize(const int width, int const height);
/* virtual */ int draw(const UINT32 dc, const int update);
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
/* virtual */ void destroy_all_textures();
@ -280,6 +280,8 @@ public:
INT32 m_blittimer;
int m_screen_width;
int m_screen_height;
int m_last_width;
int m_last_height;
#if (SDLMAME_SDL2)
SDL_GLContext m_gl_context_id;
@ -754,18 +756,6 @@ int sdl_info_ogl::create(int width, int height)
return 0;
}
//============================================================
// sdl_info::resize
//============================================================
void sdl_info_ogl::resize(int width, int height)
{
#if (SDLMAME_SDL2)
m_blittimer = 3;
#endif
m_init_context = 1;
}
//============================================================
// sdl_info::destroy
@ -1221,6 +1211,16 @@ int sdl_info_ogl::draw(UINT32 dc, int update)
return 0;
}
if ((window().width() != m_last_width) || (window().height() != m_last_height))
{
m_last_width = window().width();
m_last_height = window().height();
#if (SDLMAME_SDL2)
m_blittimer = 3;
#endif
m_init_context = 1;
}
#if (SDLMAME_SDL2)
SDL_GL_MakeCurrent(window().sdl_window(), m_gl_context_id);
#else

View File

@ -65,11 +65,12 @@ public:
m_last_hofs(0),
m_last_vofs(0),
m_old_blitwidth(0),
m_old_blitheight(0)
m_old_blitheight(0),
m_last_width(0),
m_last_height(0)
{ }
/* virtual */ int create(const int width, const int height);
/* virtual */ void resize(const int width, const int height);
/* virtual */ int draw(const UINT32 dc, const int update);
/* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt);
/* virtual */ void destroy_all_textures();
@ -107,6 +108,8 @@ public:
int m_last_vofs;
int m_old_blitwidth;
int m_old_blitheight;
int m_last_width;
int m_last_height;
};
struct sdl_scale_mode
@ -474,24 +477,6 @@ int sdl_info::create(int width, int height)
return 0;
}
//============================================================
// sdl_info::resize
//============================================================
void sdl_info::resize(int width, int height)
{
#if (SDLMAME_SDL2)
SDL_RenderSetViewport(m_sdl_renderer, NULL);
#else
const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode];
if (sdl_sm->is_yuv)
{
yuv_overlay_init();
}
#endif
}
//============================================================
// sdl_info::destroy
//============================================================
@ -580,6 +565,21 @@ int sdl_info::draw(UINT32 dc, int update)
return 0;
}
if ((window().width() != m_last_width) || (window().height() != m_last_height))
{
m_last_width = window().width();
m_last_height = window().height();
#if (SDLMAME_SDL2)
SDL_RenderSetViewport(m_sdl_renderer, NULL);
#else
const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode];
if (sdl_sm->is_yuv)
{
yuv_overlay_init();
}
#endif
}
// lock it if we need it
#if (!SDLMAME_SDL2)

View File

@ -491,9 +491,6 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_resize_wt )
window->m_height = window->m_sdlsurf->h;
#endif
window->renderer().resize(window->m_width, window->m_height);
window->blit_surface_size(window->m_width, window->m_height);
window->clear();

View File

@ -58,7 +58,6 @@ public:
bool check_flag(const int flag) { return ((m_flags & flag)) == flag; }
virtual int create(const int width, const int height) = 0;
virtual void resize(const int width, const int height) = 0;
virtual int draw(const UINT32 dc, const int update) = 0;
virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0;
virtual void destroy_all_textures() = 0;