aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorJody Northup2009-06-17 10:03:59 +0000
committerJody Northup2009-06-17 10:03:59 +0000
commitf55419ee451070dbe07014bc7d747507e431edf6 (patch)
tree312dc87d14d9b77cb8683fdf043ec32190a136ff /backends
parent78eed8b7c4c155c709ec17a73043c4d5ce597bc3 (diff)
downloadscummvm-rg350-f55419ee451070dbe07014bc7d747507e431edf6.tar.gz
scummvm-rg350-f55419ee451070dbe07014bc7d747507e431edf6.tar.bz2
scummvm-rg350-f55419ee451070dbe07014bc7d747507e431edf6.zip
OSystem_SDL::GetBestFormat will no longer return modes greater than that which hardware supports.
svn-id: r41606
Diffstat (limited to 'backends')
-rw-r--r--backends/platform/sdl/sdl.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 074a55069d..598b943e4b 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -92,13 +92,26 @@ public:
// Highest supported
virtual Graphics::PixelFormat getBestFormat() const {
//TODO scale down 16/32 bit based on hardware support
-#ifdef ENABLE_32BIT
- return Graphics::PixelFormat(Graphics::kFormatRGBA8888);
-#elif defined ENABLE_16BIT
- return Graphics::PixelFormat(Graphics::kFormatRGB565);
-#else
+#if (defined ENABLE_32BIT) || (defined ENABLE_16BIT)
+ {
+ SDL_PixelFormat *HWFormat = SDL_GetVideoInfo()->vfmt;
+#ifdef ENABLE_32BIT
+ if (HWFormat->BitsPerPixel > 32)
+ return Graphics::PixelFormat(Graphics::kFormatRGBA8888);
+ return Graphics::PixelFormat(HWFormat->BytesPerPixel,
+ HWFormat->Rloss, HWFormat->Gloss, HWFormat->Bloss, HWFormat->Aloss,
+ HWFormat->Rshift, HWFormat->Gshift, HWFormat->Bshift, HWFormat->Ashift);
+#else //16
+ if (HWFormat->BitsPerPixel > 16)
+ return Graphics::PixelFormat(Graphics::kFormatRGB565);
+ return Graphics::PixelFormat(HWFormat->BytesPerPixel,
+ HWFormat->Rloss, HWFormat->Gloss, HWFormat->Bloss, HWFormat->Aloss,
+ HWFormat->Rshift, HWFormat->Gshift, HWFormat->Bshift, HWFormat->Ashift);
+ }
+#endif //ENABLE_32BIT
+#else //8BIT only
return Graphics::PixelFormat(Graphics::kFormatCLUT8);
-#endif
+#endif //ENABLE_32BIT or ENABLE_16BIT
}
#endif