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 | |
| 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
| -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; | 
