summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/render/drawogl.cpp
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-04-25 17:09:47 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-04-25 17:09:47 +0200
commit5e831f6506ee06f8c30cb113551ee0fec53804db (patch)
tree13ac118e57f0e2f98953b6b8ba4858977dc0dad5 /src/osd/modules/render/drawogl.cpp
parent3e1af09ef5888a2dd328b0c1db94151ee4491fcb (diff)
Temp revert of Brad changes (nw)
Diffstat (limited to 'src/osd/modules/render/drawogl.cpp')
-rw-r--r--src/osd/modules/render/drawogl.cpp44
1 files changed, 15 insertions, 29 deletions
diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp
index 01d8085efd7..a7ffe24a5df 100644
--- a/src/osd/modules/render/drawogl.cpp
+++ b/src/osd/modules/render/drawogl.cpp
@@ -559,13 +559,11 @@ void renderer_ogl::initialize_gl()
int renderer_ogl::create()
{
- auto win = assert_window();
-
// create renderer
#if defined(OSD_WINDOWS)
- m_gl_context = global_alloc(win_gl_context(win->platform_window<HWND>()));
+ m_gl_context = global_alloc(win_gl_context(window().platform_window<HWND>()));
#else
- m_gl_context = global_alloc(sdl_gl_context(win->platform_window<SDL_Window*>()));
+ m_gl_context = global_alloc(sdl_gl_context(window().platform_window<SDL_Window*>()));
#endif
if (m_gl_context->LastErrorMsg() != nullptr)
{
@@ -629,19 +627,12 @@ void renderer_ogl::destroy_all_textures()
if ( !m_initialized )
return;
- auto win = try_getwindow();
-
- // During destroy this can get called
- // and the window is no longer available
- if (win == nullptr)
- return;
-
m_gl_context->MakeCurrent();
- if(win->m_primlist)
+ if(window().m_primlist)
{
lock=TRUE;
- win->m_primlist->acquire_lock();
+ window().m_primlist->acquire_lock();
}
glFinish();
@@ -703,7 +694,7 @@ void renderer_ogl::destroy_all_textures()
m_initialized = 0;
if (lock)
- win->m_primlist->release_lock();
+ window().m_primlist->release_lock();
}
//============================================================
// loadGLExtensions
@@ -923,7 +914,7 @@ void renderer_ogl::loadGLExtensions()
if ( m_useglsl )
{
- if (assert_window()->prescale() != 1 )
+ if ( window().prescale() != 1 )
{
m_useglsl = 0;
if (_once)
@@ -1032,9 +1023,7 @@ int renderer_ogl::draw(const int update)
}
#endif
- auto win = assert_window();
-
- osd_dim wdim = win->get_size();
+ osd_dim wdim = window().get_size();
if (has_flags(FI_CHANGED) || (wdim.width() != m_width) || (wdim.height() != m_height))
{
@@ -1085,7 +1074,7 @@ int renderer_ogl::draw(const int update)
// we're doing nothing 3d, so the Z-buffer is currently not interesting
glDisable(GL_DEPTH_TEST);
- if (win->machine().options().antialias())
+ if (window().machine().options().antialias())
{
// enable antialiasing for lines
glEnable(GL_LINE_SMOOTH);
@@ -1165,10 +1154,10 @@ int renderer_ogl::draw(const int update)
m_last_hofs = hofs;
m_last_vofs = vofs;
- win->m_primlist->acquire_lock();
+ window().m_primlist->acquire_lock();
// now draw
- for (render_primitive &prim : *win->m_primlist)
+ for (render_primitive &prim : *window().m_primlist)
{
int i;
@@ -1384,7 +1373,7 @@ int renderer_ogl::draw(const int update)
pendingPrimitive=GL_NO_PRIMITIVE;
}
- win->m_primlist->release_lock();
+ window().m_primlist->release_lock();
m_init_context = 0;
m_gl_context->SwapBuffer();
@@ -1519,10 +1508,8 @@ void renderer_ogl::texture_compute_size_subroutine(ogl_texture_info *texture, UI
texture->xprescale--;
while (texture->yprescale > 1 && height_create * texture->yprescale > m_texture_max_height)
texture->yprescale--;
-
- auto win = assert_window();
- if (PRIMFLAG_GET_SCREENTEX(flags) && (texture->xprescale != win->prescale() || texture->yprescale != win->prescale()))
- osd_printf_warning("SDL: adjusting prescale from %dx%d to %dx%d\n", win->prescale(), win->prescale(), texture->xprescale, texture->yprescale);
+ if (PRIMFLAG_GET_SCREENTEX(flags) && (texture->xprescale != window().prescale() || texture->yprescale != window().prescale()))
+ osd_printf_warning("SDL: adjusting prescale from %dx%d to %dx%d\n", window().prescale(), window().prescale(), texture->xprescale, texture->yprescale);
width *= texture->xprescale;
height *= texture->yprescale;
@@ -1884,9 +1871,8 @@ ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource,
texture->texinfo.seqid = -1; // force set data
if (PRIMFLAG_GET_SCREENTEX(flags))
{
- auto win = assert_window();
- texture->xprescale = win->prescale();
- texture->yprescale = win->prescale();
+ texture->xprescale = window().prescale();
+ texture->yprescale = window().prescale();
}
else
{