aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
authorJody Northup2009-06-15 09:45:19 +0000
committerJody Northup2009-06-15 09:45:19 +0000
commit8d306ebccfa7e88b2e4f4635bff3987e550f98d3 (patch)
tree937afc4b40b3d38da4a67fcd13cef91c097097cb /backends/platform/sdl
parente6f874ee9508a6631635504808680e50a4f55c7f (diff)
downloadscummvm-rg350-8d306ebccfa7e88b2e4f4635bff3987e550f98d3.tar.gz
scummvm-rg350-8d306ebccfa7e88b2e4f4635bff3987e550f98d3.tar.bz2
scummvm-rg350-8d306ebccfa7e88b2e4f4635bff3987e550f98d3.zip
Added kUnsupportedColorMode error code brought Scumm engine and SDL backend into compliance with API outlined in http://scummvmupthorn09.wordpress.com/2009/06/14/how-this-is-going-to-work/
Provided convenient Graphics::PixelFormat constructors for ColorMode enums, and bitformat integers. Removed last vestiges (I think) of initial cursor hack. svn-id: r41539
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r--backends/platform/sdl/graphics.cpp88
-rw-r--r--backends/platform/sdl/sdl.cpp4
-rw-r--r--backends/platform/sdl/sdl.h10
3 files changed, 2 insertions, 100 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp
index 0d1b3fb8aa..f550621a28 100644
--- a/backends/platform/sdl/graphics.cpp
+++ b/backends/platform/sdl/graphics.cpp
@@ -352,34 +352,6 @@ int OSystem_SDL::getGraphicsMode() const {
return _videoMode.mode;
}
#ifdef ENABLE_16BIT
-Graphics::ColorMode OSystem_SDL::findCompatibleFormat(Common::List<Graphics::ColorMode> formatList) {
- bool typeAccepted = false;
- Graphics::ColorMode format;
-
- while (!formatList.empty()) {
- typeAccepted = false;
- format = formatList.front();
-
- //no need to keep searching if the screen
- //is already in one of the desired formats
- if (getPixelFormat(format) == _videoMode.format)
- return format;
-
- formatList.pop_front();
- switch (format) {
- case Graphics::kFormatCLUT8:
- if (format == Graphics::kFormatCLUT8)
- return format;
- break;
- case Graphics::kFormatRGB555:
- case Graphics::kFormatRGB565:
- return format;
- break;
- }
- }
- return Graphics::kFormatCLUT8;
-}
-
void OSystem_SDL::initFormat(Graphics::PixelFormat format) {
assert(_transactionMode == kTransactionActive);
@@ -391,66 +363,6 @@ void OSystem_SDL::initFormat(Graphics::PixelFormat format) {
_transactionDetails.formatChanged = true;
_screenFormat = format;
}
-
-//TODO: Move this out of OSystem and into Graphics, where engine can access it.
-//TODO: ABGR support
-Graphics::PixelFormat OSystem_SDL::getPixelFormat(Graphics::ColorMode format) {
- Graphics::PixelFormat result;
- switch (format) {
- case Graphics::kFormatRGB555:
- result.aLoss = 8;
- result.bytesPerPixel = 2;
- result.rLoss = result.gLoss = result.bLoss = 3;
- break;
- case Graphics::kFormatRGB565:
- result.bytesPerPixel = 2;
- result.aLoss = 8;
- result.gLoss = 2;
- result.rLoss = result.bLoss = 3;
- break;
- case Graphics::kFormatXRGB1555:
- //Special case, alpha bit is always high in this mode.
- result.aLoss = 7;
- result.bytesPerPixel = 2;
- result.rLoss = result.gLoss = result.bLoss = 3;
- result.bShift = 0;
- result.gShift = result.bShift + result.bBits();
- result.rShift = result.gShift + result.gBits();
- result.aShift = result.rShift + result.rBits();
- //HACK: there should be a clean way to handle setting
- //up the color order without prematurely returning
- return result;
- case Graphics::kFormatRGBA4444:
- result.bytesPerPixel = 2;
- result.aLoss = result.gLoss = result.rLoss = result.bLoss = 4;
- break;
- case Graphics::kFormatRGB888:
- result.bytesPerPixel = 3;
- result.aLoss = 8;
- result.gLoss = result.rLoss = result.bLoss = 0;
- break;
- case Graphics::kFormatRGBA6666:
- result.bytesPerPixel = 3;
- result.aLoss = result.gLoss = result.rLoss = result.bLoss = 2;
- break;
- case Graphics::kFormatRGBA8888:
- result.bytesPerPixel = 4;
- result.aLoss = result.gLoss = result.rLoss = result.bLoss = 0;
- break;
- case Graphics::kFormatCLUT8:
- default:
- result.bytesPerPixel = 1;
- result.rShift = result.gShift = result.bShift = result.aShift = 0;
- result.rLoss = result.gLoss = result.bLoss = result.aLoss = 8;
- return result;
- }
-
- result.aShift = 0;
- result.bShift = result.aBits();
- result.gShift = result.bShift + result.bBits();
- result.rShift = result.gShift + result.gBits();
- return result;
-}
#endif
void OSystem_SDL::initSize(uint w, uint h) {
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 5bcd91d566..81b5fcc3eb 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -197,8 +197,8 @@ OSystem_SDL::OSystem_SDL()
#endif
_hwscreen(0), _screen(0), _tmpscreen(0),
#ifdef ENABLE_16BIT
- _screenFormat(getPixelFormat(Graphics::kFormatCLUT8)),
- _cursorBitDepth(8),
+ _screenFormat(Graphics::kFormatCLUT8),
+ _cursorFormat(Graphics::kFormatCLUT8),
#endif
_overlayVisible(false),
_overlayscreen(0), _tmpscreen2(0),
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index a25f697c80..b36139f24b 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -82,19 +82,12 @@ public:
TransactionError endGFXTransaction(void);
#ifdef ENABLE_16BIT
- // Find a compatible format from the list of formats supported by the engine
- // Fallback to CLUT8 if none found
- virtual Graphics::ColorMode findCompatibleFormat(Common::List<Graphics::ColorMode> formatList);
-
// Set the depth and format of the video bitmap
// Typically, CLUT8
virtual void initFormat(Graphics::PixelFormat format);
// Game screen
virtual Graphics::PixelFormat getScreenFormat() const { return _screenFormat; }
-
- //Create a Graphics::PixelFormat to describe the requested color mode
- virtual Graphics::PixelFormat getPixelFormat(Graphics::ColorMode format);
#endif
// Set the size of the video bitmap.
@@ -379,9 +372,6 @@ protected:
MousePos _mouseCurState;
byte _mouseKeyColor;
int _cursorTargetScale;
-#ifdef ENABLE_16BIT
- uint8 _cursorBitDepth;
-#endif
bool _cursorPaletteDisabled;
SDL_Surface *_mouseOrigSurface;
SDL_Surface *_mouseSurface;