aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorMax Horn2010-07-12 23:19:08 +0000
committerMax Horn2010-07-12 23:19:08 +0000
commite2c1ee853a1cd1ce56536a4b4436a8da5277d0cb (patch)
treefa06978cf9840470edfd6a51d637262cb3b25c0d /backends/platform/sdl
parent8e9d933658bce3b613879b4679321b1c71cfffd4 (diff)
downloadscummvm-rg350-e2c1ee853a1cd1ce56536a4b4436a8da5277d0cb.tar.gz
scummvm-rg350-e2c1ee853a1cd1ce56536a4b4436a8da5277d0cb.tar.bz2
scummvm-rg350-e2c1ee853a1cd1ce56536a4b4436a8da5277d0cb.zip
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. svn-id: r50833
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r--backends/platform/sdl/graphics.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index f48800f0d8..35c5b57db6 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -263,9 +263,6 @@ void OSystem_SDL::detectSupportedFormats() {
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 @@ void OSystem_SDL::detectSupportedFormats() {
// 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());
}