[Scummvm-cvs-logs] SF.net SVN: scummvm:[42350] scummvm/branches/gsoc2009-16bit/backends/ platform/sdl/graphics.cpp
upthorn at users.sourceforge.net
upthorn at users.sourceforge.net
Fri Jul 10 21:55:06 CEST 2009
Revision: 42350
http://scummvm.svn.sourceforge.net/scummvm/?rev=42350&view=rev
Author: upthorn
Date: 2009-07-10 19:55:06 +0000 (Fri, 10 Jul 2009)
Log Message:
-----------
Fixed a couple of errors in the new getSupportedFormats implementation.
Modified Paths:
--------------
scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp
Modified: scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp 2009-07-10 19:33:23 UTC (rev 42349)
+++ scummvm/branches/gsoc2009-16bit/backends/platform/sdl/graphics.cpp 2009-07-10 19:55:06 UTC (rev 42350)
@@ -242,22 +242,37 @@
// TODO: prioritize matching alpha masks
Common::List<Graphics::PixelFormat> OSystem_SDL::getSupportedFormats() {
static Common::List<Graphics::PixelFormat> list;
- if (!list.empty())
+ static bool inited = false;
+
+ if (inited)
return list;
+
bool BGR = false;
int listLength = ARRAYSIZE(RGBList);
- // Get our currently set format
- Graphics::PixelFormat format(_hwscreen->format->BytesPerPixel,
- _hwscreen->format->Rloss, _hwscreen->format->Gloss,
- _hwscreen->format->Bloss, _hwscreen->format->Aloss,
- _hwscreen->format->Rshift, _hwscreen->format->Gshift,
- _hwscreen->format->Bshift, _hwscreen->format->Ashift);
+ Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
+ if (_hwscreen) {
+ // Get our currently set hardware format
+ format = Graphics::PixelFormat(_hwscreen->format->BytesPerPixel,
+ _hwscreen->format->Rloss, _hwscreen->format->Gloss,
+ _hwscreen->format->Bloss, _hwscreen->format->Aloss,
+ _hwscreen->format->Rshift, _hwscreen->format->Gshift,
+ _hwscreen->format->Bshift, _hwscreen->format->Ashift);
- // Push it first, as the prefered format.
- list.push_back(format);
- if (format.bShift > format.rShift)
- BGR = true;
+ // Workaround to MacOSX SDL not providing an accurate Aloss value.
+ if (_hwscreen->format->Amask == 0)
+ format.aLoss = 8;
+
+ // Push it first, as the prefered format.
+ list.push_back(format);
+
+ if (format.bShift > format.rShift)
+ BGR = true;
+
+ // Mark that we don't need to do this any more.
+ inited = true;
+ }
+
for (int i = 0; i < listLength; i++) {
if (RGBList[i].bytesPerPixel > format.bytesPerPixel)
continue;
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