[Scummvm-cvs-logs] SF.net SVN: scummvm:[41606] scummvm/branches/gsoc2009-16bit/backends/ platform/sdl/sdl.h
upthorn at users.sourceforge.net
upthorn at users.sourceforge.net
Wed Jun 17 12:04:00 CEST 2009
Revision: 41606
http://scummvm.svn.sourceforge.net/scummvm/?rev=41606&view=rev
Author: upthorn
Date: 2009-06-17 10:03:59 +0000 (Wed, 17 Jun 2009)
Log Message:
-----------
OSystem_SDL::GetBestFormat will no longer return modes greater than that which hardware supports.
Modified Paths:
--------------
scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h 2009-06-17 05:18:48 UTC (rev 41605)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/sdl.h 2009-06-17 10:03:59 UTC (rev 41606)
@@ -92,13 +92,26 @@
// 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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list