diff options
-rw-r--r-- | graphics/cursorman.cpp | 46 | ||||
-rw-r--r-- | graphics/cursorman.h | 52 |
2 files changed, 51 insertions, 47 deletions
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp index fc9f985fae..c14dc0744f 100644 --- a/graphics/cursorman.cpp +++ b/graphics/cursorman.cpp @@ -217,4 +217,50 @@ void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint nu } } +CursorManager::Cursor::Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, const Graphics::PixelFormat *format) { +#ifdef USE_RGB_COLOR + if (!format) + _format = Graphics::PixelFormat::createFormatCLUT8(); + else + _format = *format; + _size = w * h * _format.bytesPerPixel; + _keycolor = keycolor & ((1 << (_format.bytesPerPixel << 3)) - 1); +#else + _format = Graphics::PixelFormat::createFormatCLUT8(); + _size = w * h; + _keycolor = keycolor & 0xFF; +#endif + _data = new byte[_size]; + if (data && _data) + memcpy(_data, data, _size); + _width = w; + _height = h; + _hotspotX = hotspotX; + _hotspotY = hotspotY; + _targetScale = targetScale; +} + +CursorManager::Cursor::~Cursor() { + delete[] _data; +} + +CursorManager::Palette::Palette(const byte *colors, uint start, uint num) { + _start = start; + _num = num; + _size = 4 * num; + + if (num) { + _data = new byte[_size]; + memcpy(_data, colors, _size); + } else { + _data = NULL; + } + + _disabled = false; +} + +CursorManager::Palette::~Palette() { + delete[] _data; +} + } // End of namespace Graphics diff --git a/graphics/cursorman.h b/graphics/cursorman.h index 9eaca57a09..1a5c116232 100644 --- a/graphics/cursorman.h +++ b/graphics/cursorman.h @@ -29,9 +29,6 @@ #include "common/stack.h" #include "common/singleton.h" #include "graphics/pixelformat.h" -#ifdef USE_RGB_COLOR -#include "common/system.h" -#endif namespace Graphics { @@ -181,32 +178,9 @@ private: int _targetScale; uint _size; - Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, const Graphics::PixelFormat *format = NULL) { -#ifdef USE_RGB_COLOR - if (!format) - _format = Graphics::PixelFormat::createFormatCLUT8(); - else - _format = *format; - _size = w * h * _format.bytesPerPixel; - _keycolor = keycolor & ((1 << (_format.bytesPerPixel << 3)) - 1); -#else - _format = Graphics::PixelFormat::createFormatCLUT8(); - _size = w * h; - _keycolor = keycolor & 0xFF; -#endif - _data = new byte[_size]; - if (data && _data) - memcpy(_data, data, _size); - _width = w; - _height = h; - _hotspotX = hotspotX; - _hotspotY = hotspotY; - _targetScale = targetScale; - } - - ~Cursor() { - delete[] _data; - } + + Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, const Graphics::PixelFormat *format = NULL); + ~Cursor(); }; struct Palette { @@ -217,24 +191,8 @@ private: bool _disabled; - Palette(const byte *colors, uint start, uint num) { - _start = start; - _num = num; - _size = 4 * num; - - if (num) { - _data = new byte[_size]; - memcpy(_data, colors, _size); - } else { - _data = NULL; - } - - _disabled = false; - } - - ~Palette() { - delete[] _data; - } + Palette(const byte *colors, uint start, uint num); + ~Palette(); }; Common::Stack<Cursor *> _cursorStack; Common::Stack<Palette *> _cursorPaletteStack; |