summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-01-16 16:27:50 +0100
committerMichael Lutz <michi@icosahedron.de>2021-01-17 19:57:36 +0100
commit1eceee915ede04301c411bb0465c32a3712aa0d2 (patch)
tree5814ff3bdf8f6a6511868ad5f206783e4efcf9b9 /src/video/sdl2_v.cpp
parent49df9c415595a7aa104ff5463372118ec874a4c2 (diff)
downloadopenttd-1eceee915ede04301c411bb0465c32a3712aa0d2.tar.xz
Codechange: [SDL2/Win32] Be consistent how 0bpp blitters are not allowed
Sometimes it returned an usererror(), sometimes Start() failed. Now it always fails on Start(), so nothing else has to check again what blitter is used. AfterBlitterChange() can never change to a 0bpp, so it is sufficient to guard this with an assert().
Diffstat (limited to 'src/video/sdl2_v.cpp')
-rw-r--r--src/video/sdl2_v.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp
index 685610d2c..ede8a8486 100644
--- a/src/video/sdl2_v.cpp
+++ b/src/video/sdl2_v.cpp
@@ -258,8 +258,6 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h, bool resize)
DEBUG(driver, 1, "SDL2: using mode %ux%ux%d", w, h, bpp);
- if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
-
/* Free any previously allocated shadow surface */
if (_sdl_surface != nullptr && _sdl_surface != _sdl_realscreen) SDL_FreeSurface(_sdl_surface);
@@ -664,6 +662,8 @@ int VideoDriver_SDL::PollEvent()
const char *VideoDriver_SDL::Start(const StringList &parm)
{
+ if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) return "Only real blitters supported";
+
/* Explicitly disable hardware acceleration. Enabling this causes
* UpdateWindowSurface() to update the window's texture instead of
* its surface. */
@@ -939,6 +939,7 @@ bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
bool VideoDriver_SDL::AfterBlitterChange()
{
+ assert(BlitterFactory::GetCurrentBlitter()->GetScreenDepth() != 0);
int w, h;
SDL_GetWindowSize(_sdl_window, &w, &h);
return CreateMainSurface(w, h, false);