aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJody Northup2009-06-09 07:55:43 +0000
committerJody Northup2009-06-09 07:55:43 +0000
commitc426dd99a4c4149418fa16996e38f0995ddcaea5 (patch)
tree8809c1cd7e6ee72546d4eac83854e84da079fc42
parentd3ede78c9a51b46fdfebf907988d13cc410af7ee (diff)
downloadscummvm-rg350-c426dd99a4c4149418fa16996e38f0995ddcaea5.tar.gz
scummvm-rg350-c426dd99a4c4149418fa16996e38f0995ddcaea5.tar.bz2
scummvm-rg350-c426dd99a4c4149418fa16996e38f0995ddcaea5.zip
Laying the foundation for preliminary bitdepth negotiation. (No functionality changes yet)
svn-id: r41396
-rw-r--r--backends/platform/sdl/sdl.h13
-rw-r--r--common/system.h11
-rw-r--r--graphics/pixelformat.h60
3 files changed, 83 insertions, 1 deletions
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 6fe871fa83..22d3d41b00 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -178,6 +178,12 @@ public:
// Overlay
virtual Graphics::PixelFormat getOverlayFormat() const { return _overlayFormat; }
+
+#ifdef ENABLE_16BIT
+ // Game screen
+ virtual Graphics::PixelFormat getScreenFormat() const { return _screenFormat; }
+#endif
+
virtual void showOverlay();
virtual void hideOverlay();
virtual void clearOverlay();
@@ -232,7 +238,12 @@ protected:
// unseen game screen
SDL_Surface *_screen;
#ifdef ENABLE_16BIT
- SDL_Surface *_screen16;
+ Graphics::PixelFormat _screenFormat;
+
+ //HACK This is a temporary hack to get 16-bit graphics
+ //displaying quickly, which will be removed in favor of
+ //configuring the format of _screen on a per-game basis
+ SDL_Surface *_screen16;
#endif
// temporary screen (for scalers)
diff --git a/common/system.h b/common/system.h
index ddbcdcc546..50d00bb8e2 100644
--- a/common/system.h
+++ b/common/system.h
@@ -407,6 +407,9 @@ public:
kTransactionAspectRatioFailed = (1 << 0), /**< Failed switchting aspect ratio correction mode */
kTransactionFullscreenFailed = (1 << 1), /**< Failed switchting fullscreen mode */
kTransactionModeSwitchFailed = (1 << 2), /**< Failed switchting the GFX graphics mode (setGraphicsMode) */
+#ifdef ENABLE_16BIT
+ kTransactionPixelFormatNotSupported = (1 << 4), /**< Failed setting the color format (function not yet implemented) */
+#endif
kTransactionSizeChangeFailed = (1 << 3) /**< Failed switchting the screen dimensions (initSize) */
};
@@ -605,6 +608,14 @@ public:
*/
virtual Graphics::PixelFormat getOverlayFormat() const = 0;
+#ifdef ENABLE_16BIT
+ /**
+ * Returns the pixel format description of the game screen.
+ * @see Graphics::PixelFormat
+ */
+ virtual Graphics::PixelFormat getScreenFormat() const = 0;
+#endif
+
/**
* Reset the overlay.
*
diff --git a/graphics/pixelformat.h b/graphics/pixelformat.h
index f59650e5cc..2e8c065414 100644
--- a/graphics/pixelformat.h
+++ b/graphics/pixelformat.h
@@ -30,6 +30,66 @@
namespace Graphics {
+#ifdef ENABLE_16BIT
+/**
+ * A condensed bit format description.
+ *
+ * It includes the necessary information to create a PixelFormat and/or
+ * ColorMask which fully describe the given color format.
+ *
+ * It contains two components, the format (8Bit paletted, RGB555, etc)
+ * and the order (palette, ARGB, ABGR, etc)
+ *
+ * Use (format & kFormatTypeMask) to get the type, and (format & kFormatOrderMask)
+ * to get the applicable color order.
+ */
+enum ColorFormat {
+ kFormat8Bit = 0,
+ kFormatRGB555 = 1,
+ kFormatARGB1555 = 2, // Rare, but I know a guy who knows a guy who's heard of it being used
+ kFormatRGB556 = 3, // 6 bits for blue, in case this ever happens
+ kFormatRGB565 = 4,
+ kFormatRGB655 = 5, // 6 bits for red, in case this ever happens
+ kFormatARGB4444 = 6,
+ kFormatRGB888 = 7,
+ kFormatARGB6666 = 8, // I've never heard of this, but it's theoretically possible
+ kFormatARGB8888 = 9,
+ kFormatTypeMask = 0xFF, // & by this to get the overall bit format
+ kFormatPalette = 0 << 8,
+ kFormatRGB = 1 << 8,
+ kFormatRBG = 2 << 8,
+ kFormatGRB = 3 << 8,
+ kFormatGBR = 4 << 8,
+ kFormatBRG = 5 << 8,
+ kFormatBGR = 6 << 8,
+ kFormatARGB = 7 << 8,
+ kFormatARBG = 8 << 8,
+ kFormatAGRB = 9 << 8,
+ kFormatAGBR = 10 << 8,
+ kFormatABRG = 11 << 8,
+ kFormatABGR = 12 << 8,
+ kFormatRAGB = 13 << 8,
+ kFormatRABG = 14 << 8,
+ kFormatGARB = 15 << 8,
+ kFormatGABR = 16 << 8,
+ kFormatBARG = 17 << 8,
+ kFormatBAGR = 18 << 8,
+ kFormatRGAB = 19 << 8,
+ kFormatRBAG = 20 << 8,
+ kFormatGRAB = 21 << 8,
+ kFormatGBAR = 22 << 8,
+ kFormatBRAG = 23 << 8,
+ kFormatBGAR = 24 << 8,
+ kFormatRGBA = 25 << 8,
+ kFormatRBGA = 26 << 8,
+ kFormatGRBA = 27 << 8,
+ kFormatGBRA = 28 << 8,
+ kFormatBRGA = 29 << 8,
+ kFormatBGRA = 30 << 8,
+ kFormatOrderMask = 0xFF << 8 // & by this to get the order
+};
+#endif
+
/**
* A pixel format description.
*