Skip to content

Commit

Permalink
Windows SDL 1.x: Additional fixes for correct display on displays and…
Browse files Browse the repository at this point in the history
… remote desktop sessions using the 15-bit highcolor (5:5:5) format.
  • Loading branch information
joncampbell123 committed Jan 7, 2018
1 parent 5f4f9b5 commit 0a3f902
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/gui/sdlmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,18 @@ Bitu GFX_SetSize(Bitu width,Bitu height,Bitu flags,double scalex,double scaley,G
if (flags & GFX_CAN_15) bpp=15;
if (flags & GFX_CAN_16) bpp=16;
if (flags & GFX_CAN_32) bpp=32;

#if defined(WIN32) && !defined(C_SDL2)
/* SDL 1.x might mis-inform us on 16bpp for 15-bit color, which is bad enough.
But on Windows, we're still required to ask for 16bpp to get the 15bpp mode we want. */
if (bpp == 15) {
if (sdl.surface->format->Gshift == 5 && sdl.surface->format->Gmask == (31U << 5U)) {
LOG_MSG("SDL hack: Asking for 16-bit color (5:6:5) to get SDL to give us 15-bit color (5:5:5) to match your screen.");
bpp = 16;
}
}
#endif

sdl.desktop.type=SCREEN_SURFACE;
sdl.clip.w=width;
sdl.clip.h=height;
Expand Down Expand Up @@ -1200,7 +1212,12 @@ Bitu GFX_SetSize(Bitu width,Bitu height,Bitu flags,double scalex,double scaley,G
retFlags = GFX_CAN_15;
break;
case 16:
retFlags = GFX_CAN_16;
if (sdl.surface->format->Gshift == 5 && sdl.surface->format->Gmask == (31U << 5U)) {
retFlags = GFX_CAN_15;
}
else {
retFlags = GFX_CAN_16;
}
break;
case 32:
retFlags = GFX_CAN_32;
Expand Down

0 comments on commit 0a3f902

Please sign in to comment.