summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/sdl/drawbgfx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/sdl/drawbgfx.c')
-rw-r--r--src/osd/sdl/drawbgfx.c94
1 files changed, 4 insertions, 90 deletions
diff --git a/src/osd/sdl/drawbgfx.c b/src/osd/sdl/drawbgfx.c
index 0adc8523082..a9804dc1b2a 100644
--- a/src/osd/sdl/drawbgfx.c
+++ b/src/osd/sdl/drawbgfx.c
@@ -76,7 +76,6 @@ public:
sdl_info_bgfx(sdl_window_info *w)
: osd_renderer(w, FLAG_NONE), m_blittimer(0), m_renderer(NULL),
m_last_hofs(0), m_last_vofs(0),
- m_resize_pending(0), m_resize_width(0), m_resize_height(0),
m_last_blit_time(0), m_last_blit_pixels(0)
{}
@@ -101,12 +100,6 @@ public:
float m_last_hofs;
float m_last_vofs;
- // resize information
-
- UINT8 m_resize_pending;
- UINT32 m_resize_width;
- UINT32 m_resize_height;
-
// Stats
INT64 m_last_blit_time;
INT64 m_last_blit_pixels;
@@ -144,76 +137,13 @@ int drawbgfx_init(running_machine &machine, sdl_draw_info *callbacks)
int sdl_info_bgfx::create(int width, int height)
{
- /* FIXME: On Ubuntu and potentially other Linux OS you should use
- * to disable panning. This has to be done before every invocation of mame.
- *
- * xrandr --output HDMI-0 --panning 0x0+0+0 --fb 0x0
- *
- */
-
- osd_printf_verbose("Enter drawsdl2_window_create\n");
-
- UINT32 extra_flags = (window().fullscreen() ?
- SDL_WINDOW_BORDERLESS | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE);
-
-#if defined(SDLMAME_WIN32)
- SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
-#endif
- // create the SDL window
- window().m_sdl_window = SDL_CreateWindow(window().m_title,
- window().monitor()->position_size().x, window().monitor()->position_size().y,
- width, height, extra_flags);
-
- if (window().fullscreen() && video_config.switchres)
- {
- SDL_DisplayMode mode;
- //SDL_GetCurrentDisplayMode(window().monitor()->handle, &mode);
- SDL_GetWindowDisplayMode(window().m_sdl_window, &mode);
- m_original_mode = mode;
- mode.w = width;
- mode.h = height;
- if (window().m_refresh)
- mode.refresh_rate = window().m_refresh;
-
- SDL_SetWindowDisplayMode(window().m_sdl_window, &mode); // Try to set mode
-#ifndef SDLMAME_WIN32
- /* FIXME: Warp the mouse to 0,0 in case a virtual desktop resolution
- * is in place after the mode switch - which will most likely be the case
- * This is a hack to work around a deficiency in SDL2
- */
- SDL_WarpMouseInWindow(window().m_sdl_window, 1, 1);
-#endif
- }
- else
- {
- //SDL_SetWindowDisplayMode(window().m_sdl_window, NULL); // Use desktop
- }
// create renderer
- if (video_config.waitvsync)
- m_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
- else
- m_renderer = SDL_CreateRenderer(window().m_sdl_window, -1, SDL_RENDERER_ACCELERATED);
-
- if (!m_renderer)
- {
- fatalerror("Error on creating renderer: %s\n", SDL_GetError());
- }
-
- //SDL_SelectRenderer(window().m_sdl_window);
- SDL_ShowWindow(window().m_sdl_window);
- //SDL_SetWindowFullscreen(window().window_id, window().fullscreen);
- SDL_RaiseWindow(window().m_sdl_window);
-
- SDL_GetWindowSize(window().m_sdl_window, &window().m_width, &window().m_height);
-
m_blittimer = 3;
- SDL_RenderPresent(m_renderer);
-
bgfx::sdlSetWindow(window().m_sdl_window);
bgfx::init();
- bgfx::reset(window().m_width, window().m_height, BGFX_RESET_VSYNC);
+ bgfx::reset(window().width(), window().height(), BGFX_RESET_VSYNC);
// Enable debug text.
bgfx::setDebug(BGFX_DEBUG_STATS);// BGFX_DEBUG_TEXT);
@@ -227,13 +157,6 @@ int sdl_info_bgfx::create(int width, int height)
void sdl_info_bgfx::resize(int width, int height)
{
- m_resize_pending = 1;
- m_resize_height = height;
- m_resize_width = width;
-
- window().m_width = width;
- window().m_height = height;
-
m_blittimer = 3;
}
@@ -245,9 +168,9 @@ int sdl_info_bgfx::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 >= window().m_blitwidth)
+ if (*xt<0 || *xt >= window().blitwidth())
return 0;
- if (*yt<0 || *yt >= window().m_blitheight)
+ if (*yt<0 || *yt >= window().blitheight())
return 0;
return 1;
}
@@ -265,7 +188,7 @@ int sdl_info_bgfx::draw(UINT32 dc, int update)
, 0
);
// Set view 0 default viewport.
- bgfx::setViewRect(0, 0, 0, window().m_blitwidth, window().m_blitheight);
+ bgfx::setViewRect(0, 0, 0, window().blitwidth(), window().blitheight());
// This dummy draw call is here to make sure that view 0 is cleared
// if no other draw calls are submitted to view 0.
@@ -298,15 +221,6 @@ void sdl_info_bgfx::destroy()
destroy_all_textures();
- if (window().fullscreen() && video_config.switchres)
- {
- SDL_SetWindowFullscreen(window().m_sdl_window, 0); // Try to set mode
- SDL_SetWindowDisplayMode(window().m_sdl_window, &m_original_mode); // Try to set mode
- SDL_SetWindowFullscreen(window().m_sdl_window, SDL_WINDOW_FULLSCREEN); // Try to set mode
- }
-
- SDL_DestroyWindow(window().m_sdl_window);
-
// Shutdown bgfx.
bgfx::shutdown();
}