File diff r24664:2cee0b64ad6e → r24665:20a8caea4459
src/video/sdl2_v.cpp
Show inline comments
 
@@ -665,24 +665,26 @@ const char *VideoDriver_SDL::Start(const
 
	SDL_SetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION, "0");
 
	SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1");
 

	
 
	/* Just on the offchance the audio subsystem started before the video system,
 
	 * check whether any part of SDL has been initialised before getting here.
 
	 * Slightly duplicated with sound/sdl_s.cpp */
 
	int ret_code = 0;
 
	if (SDL_WasInit(SDL_INIT_VIDEO) == 0) {
 
		ret_code = SDL_InitSubSystem(SDL_INIT_VIDEO);
 
	}
 
	if (ret_code < 0) return SDL_GetError();
 

	
 
	this->UpdateAutoResolution();
 

	
 
	GetVideoModes();
 
	if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height, false)) {
 
		return SDL_GetError();
 
	}
 

	
 
	const char *dname = SDL_GetCurrentVideoDriver();
 
	DEBUG(driver, 1, "SDL2: using driver '%s'", dname);
 

	
 
	MarkWholeScreenDirty();
 

	
 
	_draw_threaded = !GetDriverParamBool(parm, "no_threads") && !GetDriverParamBool(parm, "no_thread");
 

	
 
@@ -921,13 +923,21 @@ bool VideoDriver_SDL::AfterBlitterChange
 
}
 

	
 
void VideoDriver_SDL::AcquireBlitterLock()
 
{
 
	if (_draw_mutex != nullptr) _draw_mutex->lock();
 
}
 

	
 
void VideoDriver_SDL::ReleaseBlitterLock()
 
{
 
	if (_draw_mutex != nullptr) _draw_mutex->unlock();
 
}
 

	
 
Dimension VideoDriver_SDL::GetScreenSize() const
 
{
 
	SDL_DisplayMode mode;
 
	if (SDL_GetCurrentDisplayMode(0, &mode) != 0) return VideoDriver::GetScreenSize();
 

	
 
	return { static_cast<uint>(mode.w), static_cast<uint>(mode.h) };
 
}
 

	
 
#endif /* WITH_SDL2 */