diff options
Diffstat (limited to 'backends/platform')
| -rw-r--r-- | backends/platform/sdl/graphics.cpp | 23 | ||||
| -rw-r--r-- | backends/platform/sdl/sdl.h | 4 | 
2 files changed, 15 insertions, 12 deletions
diff --git a/backends/platform/sdl/graphics.cpp b/backends/platform/sdl/graphics.cpp index a45f31108b..27f32ee8d2 100644 --- a/backends/platform/sdl/graphics.cpp +++ b/backends/platform/sdl/graphics.cpp @@ -125,7 +125,7 @@ OSystem::TransactionError OSystem_SDL::endGFXTransaction(void) {  			_videoMode.scaleFactor = _oldVideoMode.scaleFactor;  #ifdef ENABLE_RGB_COLOR  		} else if (_videoMode.format != _oldVideoMode.format) { -			errors |= kTransactionPixelFormatNotSupported; +			errors |= kTransactionFormatNotSupported;  			_videoMode.format = _oldVideoMode.format;  			_screenFormat = _videoMode.format; @@ -354,21 +354,24 @@ int OSystem_SDL::getGraphicsMode() const {  	return _videoMode.mode;  } -void OSystem_SDL::initSize(uint w, uint h, Graphics::PixelFormat *format) { +void OSystem_SDL::initSize(uint w, uint h, const Graphics::PixelFormat *format) {  	assert(_transactionMode == kTransactionActive);  #ifdef ENABLE_RGB_COLOR  	//avoid redundant format changes +	Graphics::PixelFormat newFormat;  	if (!format) -		format = new Graphics::PixelFormat(1,8,8,8,8,0,0,0,0); +		newFormat = Graphics::PixelFormat::createFormatCLUT8(); +	else +		newFormat = *format; -	assert(format->bytesPerPixel > 0); +	assert(newFormat.bytesPerPixel > 0); -	if (*format != _videoMode.format) +	if (newFormat != _videoMode.format)  	{ -		_videoMode.format = *format; +		_videoMode.format = newFormat;  		_transactionDetails.formatChanged = true; -		_screenFormat = *format; +		_screenFormat = newFormat;  	}  #endif @@ -1373,11 +1376,11 @@ void OSystem_SDL::warpMouse(int x, int y) {  	}  } -void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, Graphics::PixelFormat *format) { +void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {  #ifdef ENABLE_RGB_COLOR  	if (!format) -		format = new Graphics::PixelFormat(1,8,8,8,8,0,0,0,0); -	if (format->bytesPerPixel <= _screenFormat.bytesPerPixel) +		_cursorFormat = Graphics::PixelFormat(1,8,8,8,8,0,0,0,0); +	else if (format->bytesPerPixel <= _screenFormat.bytesPerPixel)  		_cursorFormat = *format;  	keycolor &= (1 << (_cursorFormat.bytesPerPixel << 3)) - 1;  #else diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index befb82cc89..68dfe64d53 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -123,7 +123,7 @@ public:  	// Set the size and format of the video bitmap.  	// Typically, 320x200 CLUT8 -	virtual void initSize(uint w, uint h, Graphics::PixelFormat *format); // overloaded by CE backend +	virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format); // overloaded by CE backend  	virtual int getScreenChangeID() const { return _screenChangeCount; } @@ -152,7 +152,7 @@ public:  	virtual void warpMouse(int x, int y); // overloaded by CE backend (FIXME)  	// Set the bitmap that's used when drawing the cursor. -	virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, Graphics::PixelFormat *format); // overloaded by CE backend (FIXME) +	virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); // overloaded by CE backend (FIXME)  	// Set colors of cursor palette  	void setCursorPalette(const byte *colors, uint start, uint num);  | 
