diff options
author | Johannes Schickel | 2009-12-09 23:04:54 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-12-09 23:04:54 +0000 |
commit | 7605a35fd7695c292c8176b3ea885d2be03e35cf (patch) | |
tree | 73ae1249312bdef26cfe3a0c0ff76ced89970381 /graphics/cursorman.cpp | |
parent | 2f372d79d5b792b624dc585840131f8e5ad9be5e (diff) | |
download | scummvm-rg350-7605a35fd7695c292c8176b3ea885d2be03e35cf.tar.gz scummvm-rg350-7605a35fd7695c292c8176b3ea885d2be03e35cf.tar.bz2 scummvm-rg350-7605a35fd7695c292c8176b3ea885d2be03e35cf.zip |
Cleanup: Move constructor/destructor definition of CursorManager::Cursor and CursorManager::Palette to cursorman.cpp.
svn-id: r46324
Diffstat (limited to 'graphics/cursorman.cpp')
-rw-r--r-- | graphics/cursorman.cpp | 46 |
1 files changed, 46 insertions, 0 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 |