[Scummvm-cvs-logs] SF.net SVN: scummvm:[41900] scummvm/branches/gsoc2009-16bit
upthorn at users.sourceforge.net
upthorn at users.sourceforge.net
Fri Jun 26 10:50:11 CEST 2009
Revision: 41900
http://scummvm.svn.sourceforge.net/scummvm/?rev=41900&view=rev
Author: upthorn
Date: 2009-06-26 08:50:11 +0000 (Fri, 26 Jun 2009)
Log Message:
-----------
Changed cursor manager functions to take *Graphics::PixelFormat with default parameter of NULL (and initialize NULL pointers with CLUT8), rather than taking a Graphics::PixelFormat with default parameter of Graphics::PixelFormat::createFormatCLUT8()
Modified Paths:
--------------
scummvm/branches/gsoc2009-16bit/engines/scumm/cursor.cpp
scummvm/branches/gsoc2009-16bit/graphics/cursorman.cpp
scummvm/branches/gsoc2009-16bit/graphics/cursorman.h
Modified: scummvm/branches/gsoc2009-16bit/engines/scumm/cursor.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/scumm/cursor.cpp 2009-06-26 01:15:16 UTC (rev 41899)
+++ scummvm/branches/gsoc2009-16bit/engines/scumm/cursor.cpp 2009-06-26 08:50:11 UTC (rev 41900)
@@ -113,11 +113,12 @@
void ScummEngine::updateCursor() {
int transColor = (_game.heversion >= 80) ? 5 : 255;
#ifdef ENABLE_RGB_COLOR
+ Graphics::PixelFormat format = _system->getScreenFormat();
CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height,
_cursor.hotspotX, _cursor.hotspotY,
(_game.platform == Common::kPlatformNES ? _grabbedCursor[63] : transColor),
(_game.heversion == 70 ? 2 : 1),
- _system->getScreenFormat());
+ &format);
#else
CursorMan.replaceCursor(_grabbedCursor, _cursor.width, _cursor.height,
_cursor.hotspotX, _cursor.hotspotY,
Modified: scummvm/branches/gsoc2009-16bit/graphics/cursorman.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/graphics/cursorman.cpp 2009-06-26 01:15:16 UTC (rev 41899)
+++ scummvm/branches/gsoc2009-16bit/graphics/cursorman.cpp 2009-06-26 08:50:11 UTC (rev 41900)
@@ -57,14 +57,14 @@
return g_system->showMouse(visible);
}
-void CursorManager::pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, Graphics::PixelFormat format) {
+void CursorManager::pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, Graphics::PixelFormat *format) {
Cursor *cur = new Cursor(buf, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
cur->_visible = isVisible();
_cursorStack.push(cur);
if (buf) {
- g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
+ g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, *format);
}
}
@@ -100,7 +100,7 @@
g_system->showMouse(isVisible());
}
-void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, Graphics::PixelFormat format) {
+void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int targetScale, Graphics::PixelFormat *format) {
if (_cursorStack.empty()) {
pushCursor(buf, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
@@ -110,7 +110,10 @@
Cursor *cur = _cursorStack.top();
#ifdef ENABLE_RGB_COLOR
- uint size = w * h * format.bytesPerPixel;
+ if (!format)
+ format = new Graphics::PixelFormat(1,8,8,8,8,0,0,0,0);
+
+ uint size = w * h * format->bytesPerPixel;
#else
uint size = w * h;
#endif
@@ -131,10 +134,10 @@
cur->_keycolor = keycolor;
cur->_targetScale = targetScale;
#ifdef ENABLE_RGB_COLOR
- cur->_format = format;
+ cur->_format = *format;
#endif
- g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, format);
+ g_system->setMouseCursor(cur->_data, w, h, hotspotX, hotspotY, keycolor, targetScale, *format);
}
void CursorManager::disableCursorPalette(bool disable) {
Modified: scummvm/branches/gsoc2009-16bit/graphics/cursorman.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/graphics/cursorman.h 2009-06-26 01:15:16 UTC (rev 41899)
+++ scummvm/branches/gsoc2009-16bit/graphics/cursorman.h 2009-06-26 08:50:11 UTC (rev 41900)
@@ -61,7 +61,7 @@
* 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, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8());
+ void pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, Graphics::PixelFormat *format = NULL);
/**
* Pop a cursor from the stack, and restore the previous one to the
@@ -83,7 +83,7 @@
* @param targetScale the scale for which the cursor is designed
* @param format the pixel format which the cursor graphic uses
*/
- void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8());
+ void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, Graphics::PixelFormat *format = NULL);
/**
* Pop all of the cursors and cursor palettes from their respective stacks.
@@ -154,11 +154,13 @@
byte _targetScale;
uint _size;
- Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8()) {
+ Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 0xFFFFFFFF, int targetScale = 1, Graphics::PixelFormat *format = NULL) {
#ifdef ENABLE_RGB_COLOR
- _size = w * h * format.bytesPerPixel;
- _keycolor = keycolor & ((1 << (format.bytesPerPixel << 3)) - 1);
- _format = format;
+ if (!format)
+ format = new Graphics::PixelFormat(1,8,8,8,8,0,0,0,0);
+ _size = w * h * format->bytesPerPixel;
+ _keycolor &= ((1 << (format->bytesPerPixel << 3)) - 1);
+ _format = *format;
#else
_size = w * h;
_keycolor = keycolor & 0xFF;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list