aboutsummaryrefslogtreecommitdiff
path: root/graphics/cursorman.h
diff options
context:
space:
mode:
authorJody Northup2009-06-11 05:56:00 +0000
committerJody Northup2009-06-11 05:56:00 +0000
commit6adbd0c41e79b5a21f0430e060347d4978e9ce78 (patch)
treee8d99c06d597b74a64b7d1590885c13db2f03010 /graphics/cursorman.h
parentb4c44a018b636a9805c725f9a286e58be554afc2 (diff)
downloadscummvm-rg350-6adbd0c41e79b5a21f0430e060347d4978e9ce78.tar.gz
scummvm-rg350-6adbd0c41e79b5a21f0430e060347d4978e9ce78.tar.bz2
scummvm-rg350-6adbd0c41e79b5a21f0430e060347d4978e9ce78.zip
Renamed Graphics::ColorFormat to Graphics::ColorMode, streamlined enum by removing order section and temporarily removing kFormatARGB1555
Converted cursor code to make use of _screenFormat, instead of a parameter passed directly to it by the engine. Adjusted scumm engine to account for these changes. This should probably have been two separate commits, but the changes concern the same files... svn-id: r41443
Diffstat (limited to 'graphics/cursorman.h')
-rw-r--r--graphics/cursorman.h45
1 files changed, 22 insertions, 23 deletions
diff --git a/graphics/cursorman.h b/graphics/cursorman.h
index 481567bb09..0c02292818 100644
--- a/graphics/cursorman.h
+++ b/graphics/cursorman.h
@@ -28,6 +28,10 @@
#include "common/scummsys.h"
#include "common/stack.h"
#include "common/singleton.h"
+#ifdef ENABLE_16BIT
+#include "graphics/pixelformat.h"
+#include "common/system.h"
+#endif
namespace Graphics {
@@ -56,10 +60,11 @@ public:
* useful to push a "dummy" cursor and modify it later. The
* cursor will be added to the stack, but not to the backend.
*/
- void pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int targetScale = 1);
-#ifdef ENABLE_16BIT
- void pushCursorReal(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, uint8 bitDepth = 8);
-#endif
+//#ifdef ENABLE_16BIT
+ void pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1);
+//#else
+// void pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int targetScale = 1);
+//#endif
/**
* Pop a cursor from the stack, and restore the previous one to the
@@ -80,11 +85,11 @@ public:
* @param keycolor the index for the transparent color
* @param targetScale the scale for which the cursor is designed
*/
- void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int targetScale = 1);
-#ifdef ENABLE_16BIT
- //HACK made a separate method to avoid massive linker errors on every engine.
- void replaceCursorReal(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, uint8 bitDepth = 8);
-#endif
+//#ifdef ENABLE_16BIT
+ void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1);
+//#else
+// void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int targetScale = 1);
+//#endif
/**
* Pop all of the cursors and cursor palettes from their respective stacks.
@@ -148,28 +153,22 @@ private:
uint _height;
int _hotspotX;
int _hotspotY;
-#ifdef ENABLE_16BIT
+//#ifdef ENABLE_16BIT
uint32 _keycolor;
- uint8 _bitDepth;
-#else
- byte _keycolor;
-#endif
+//#else
+// byte _keycolor;
+//#endif
byte _targetScale;
uint _size;
#ifdef ENABLE_16BIT
Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, uint8 bitDepth = 8) {
- uint32 colmask = 0xFF;
- uint8 byteDepth = bitDepth >> 3;
- _size = w * h * byteDepth;
- _bitDepth = bitDepth;
- for (int i = byteDepth; i > 1; i--) {
- colmask <<= 8;
- colmask |= 0xFF;
+ { //limit the lifespan of the format value to minimize impact on memory usage
+ Graphics::PixelFormat f = g_system->getScreenFormat();
+ _size = w * h * f.bytesPerPixel;
+ _keycolor = keycolor & ((1 << (f.bytesPerPixel << 3)) - 1);
}
- _keycolor = keycolor & colmask;
-
#else
Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int targetScale = 1) {
_size = w * h;