summaryrefslogtreecommitdiff
path: root/src/i_video.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/i_video.c')
-rw-r--r--src/i_video.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/i_video.c b/src/i_video.c
index 7c739c17..5debedb8 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -194,7 +194,7 @@ int screen_height = SCREENHEIGHT;
// Color depth.
-int screen_bpp = 8;
+int screen_bpp = 0;
// Automatically adjust video settings if the selected mode is
// not a valid video mode.
@@ -1462,6 +1462,19 @@ static void AutoAdjustColorDepth(void)
const SDL_VideoInfo *info;
int flags;
+ // If screen_bpp=0, we should use the current (default) pixel depth.
+ // Fetch it from SDL.
+
+ if (screen_bpp == 0)
+ {
+ info = SDL_GetVideoInfo();
+
+ if (info != NULL && info->vfmt != NULL)
+ {
+ screen_bpp = info->vfmt->BitsPerPixel;
+ }
+ }
+
if (fullscreen)
{
flags = SDL_FULLSCREEN;