[Scummvm-cvs-logs] SF.net SVN: scummvm:[50833] scummvm/trunk/backends/platform/sdl/graphics. cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Jul 13 01:19:09 CEST 2010
Revision: 50833
http://scummvm.svn.sourceforge.net/scummvm/?rev=50833&view=rev
Author: fingolfin
Date: 2010-07-12 23:19:08 +0000 (Mon, 12 Jul 2010)
Log Message:
-----------
SDL: Tweak OSystem_SDL::detectSupportedFormats a bit
Previously, the code in OSystem_SDL::detectSupportedFormats
assumed that the arrays RGBList and BGRList had the exact
same length, and that the entries in each mirrored those in
the other 100%. Instead of relying on that, the code now
simply iterates over both lists separately. This changes the
resulting order a bit, but since we never gave any
guarantees on that, this should not matter.
Modified Paths:
--------------
scummvm/trunk/backends/platform/sdl/graphics.cpp
Modified: scummvm/trunk/backends/platform/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/platform/sdl/graphics.cpp 2010-07-12 23:18:44 UTC (rev 50832)
+++ scummvm/trunk/backends/platform/sdl/graphics.cpp 2010-07-12 23:19:08 UTC (rev 50833)
@@ -263,9 +263,6 @@
Graphics::PixelFormat(2, 4, 4, 4, 4, 4, 8, 12, 0)
};
- bool BGR = false;
- int listLength = ARRAYSIZE(RGBList);
-
Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
if (_hwscreen) {
// Get our currently set hardware format
@@ -281,25 +278,28 @@
// Push it first, as the prefered format.
_supportedFormats.push_back(format);
-
- if (format.bShift > format.rShift)
- BGR = true;
}
// TODO: prioritize matching alpha masks
- for (int i = 0; i < listLength; i++) {
+ int i;
+
+ // Push some RGB formats
+ for (i = 0; i < ARRAYSIZE(RGBList); i++) {
if (_hwscreen && (RGBList[i].bytesPerPixel > format.bytesPerPixel))
continue;
- if (BGR) {
- if (BGRList[i] != format)
- _supportedFormats.push_back(BGRList[i]);
+ if (RGBList[i] != format)
_supportedFormats.push_back(RGBList[i]);
- } else {
- if (RGBList[i] != format)
- _supportedFormats.push_back(RGBList[i]);
+ }
+
+ // Push some BGR formats
+ for (i = 0; i < ARRAYSIZE(BGRList); i++) {
+ if (_hwscreen && (BGRList[i].bytesPerPixel > format.bytesPerPixel))
+ continue;
+ if (BGRList[i] != format)
_supportedFormats.push_back(BGRList[i]);
- }
}
+
+ // Finally, we always supposed 8 bit palette graphics
_supportedFormats.push_back(Graphics::PixelFormat::createFormatCLUT8());
}
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