Skip to content

Commit

Permalink
BACKENDS: Make OSystem::setMouseCursor take a "const void *" buffer.
Browse files Browse the repository at this point in the history
This is mainly for consistency with OSystem::copyRectToScreen.
  • Loading branch information
Johannes Schickel committed Jun 16, 2012
1 parent 58bf809 commit d27d951
Show file tree
Hide file tree
Showing 27 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion backends/graphics/graphics.h
Expand Up @@ -80,7 +80,7 @@ class GraphicsManager : public PaletteManager {

virtual bool showMouse(bool visible) = 0;
virtual void warpMouse(int x, int y) = 0;
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0;
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0;
virtual void setCursorPalette(const byte *colors, uint start, uint num) = 0;

virtual void displayMessageOnOSD(const char *msg) {}
Expand Down
2 changes: 1 addition & 1 deletion backends/graphics/null/null-graphics.h
Expand Up @@ -78,7 +78,7 @@ class NullGraphicsManager : public GraphicsManager {

bool showMouse(bool visible) { return !visible; }
void warpMouse(int x, int y) {}
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) {}
void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) {}
void setCursorPalette(const byte *colors, uint start, uint num) {}
};

Expand Down
2 changes: 1 addition & 1 deletion backends/graphics/opengl/opengl-graphics.cpp
Expand Up @@ -591,7 +591,7 @@ void OpenGLGraphicsManager::warpMouse(int x, int y) {
setInternalMousePosition(scaledX, scaledY);
}

void OpenGLGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
#ifdef USE_RGB_COLOR
if (format)
_cursorFormat = *format;
Expand Down
2 changes: 1 addition & 1 deletion backends/graphics/opengl/opengl-graphics.h
Expand Up @@ -104,7 +104,7 @@ class OpenGLGraphicsManager : public GraphicsManager {

virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);

virtual void displayMessageOnOSD(const char *msg);
Expand Down
2 changes: 1 addition & 1 deletion backends/graphics/surfacesdl/surfacesdl-graphics.cpp
Expand Up @@ -1715,7 +1715,7 @@ void SurfaceSdlGraphicsManager::warpMouse(int x, int y) {
}
}

void SurfaceSdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
#ifdef USE_RGB_COLOR
if (!format)
_cursorFormat = Graphics::PixelFormat::createFormatCLUT8();
Expand Down
2 changes: 1 addition & 1 deletion backends/graphics/surfacesdl/surfacesdl-graphics.h
Expand Up @@ -131,7 +131,7 @@ class SurfaceSdlGraphicsManager : public GraphicsManager, public SdlGraphicsMana

virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);

#ifdef USE_OSD
Expand Down
2 changes: 1 addition & 1 deletion backends/graphics/wincesdl/wincesdl-graphics.cpp
Expand Up @@ -1129,7 +1129,7 @@ void WINCESdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x
SDL_UnlockSurface(_screen);
}

void WINCESdlGraphicsManager::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
void WINCESdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {

undrawMouse();
if (w == 0 || h == 0)
Expand Down
2 changes: 1 addition & 1 deletion backends/graphics/wincesdl/wincesdl-graphics.h
Expand Up @@ -73,7 +73,7 @@ class WINCESdlGraphicsManager : public SurfaceSdlGraphicsManager {
void internDrawMouse();
void undrawMouse();
bool showMouse(bool visible);
void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // overloaded by CE backend
void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format); // overloaded by CE backend
void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME)
Graphics::Surface *lockScreen();
Expand Down
2 changes: 1 addition & 1 deletion backends/modular-backend.cpp
Expand Up @@ -195,7 +195,7 @@ void ModularBackend::warpMouse(int x, int y) {
_graphicsManager->warpMouse(x, y);
}

void ModularBackend::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
void ModularBackend::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
_graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format);
}

Expand Down
2 changes: 1 addition & 1 deletion backends/modular-backend.h
Expand Up @@ -100,7 +100,7 @@ class ModularBackend : public BaseBackend {

virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);

//@}
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/android/android.h
Expand Up @@ -267,7 +267,7 @@ class OSystem_Android : public EventsBaseBackend, public PaletteManager {
virtual bool showMouse(bool visible);

virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
int hotspotY, uint32 keycolor,
bool dontScale,
const Graphics::PixelFormat *format);
Expand Down
4 changes: 2 additions & 2 deletions backends/platform/android/gfx.cpp
Expand Up @@ -685,7 +685,7 @@ bool OSystem_Android::showMouse(bool visible) {
return true;
}

void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
void OSystem_Android::setMouseCursor(const void *buf, uint w, uint h,
int hotspotX, int hotspotY,
uint32 keycolor, bool dontScale,
const Graphics::PixelFormat *format) {
Expand Down Expand Up @@ -741,7 +741,7 @@ void OSystem_Android::setMouseCursor(const byte *buf, uint w, uint h,
byte *tmp = new byte[pitch * h];

// meh, a 16bit cursor without alpha bits... this is so silly
if (!crossBlit(tmp, buf, pitch, w * 2, w, h,
if (!crossBlit(tmp, (const byte *)buf, pitch, w * 2, w, h,
_mouse_texture->getPixelFormat(),
*format)) {
LOGE("crossblit failed");
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/dc/dc.h
Expand Up @@ -142,7 +142,7 @@ class OSystem_Dreamcast : private DCHardware, public EventsBaseBackend, public P
void warpMouse(int x, int y);

// Set the bitmap that's used when drawing the cursor.
void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format);

// Replace the specified range of cursor the palette with new colors.
void setCursorPalette(const byte *colors, uint start, uint num);
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/dc/display.cpp
Expand Up @@ -292,7 +292,7 @@ void OSystem_Dreamcast::warpMouse(int x, int y)
_ms_cur_y = y;
}

void OSystem_Dreamcast::setMouseCursor(const byte *buf, uint w, uint h,
void OSystem_Dreamcast::setMouseCursor(const void *buf, uint w, uint h,
int hotspot_x, int hotspot_y,
uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format)
{
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/ds/arm9/source/osystem_ds.cpp
Expand Up @@ -580,7 +580,7 @@ bool OSystem_DS::showMouse(bool visible) {
void OSystem_DS::warpMouse(int x, int y) {
}

void OSystem_DS::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
void OSystem_DS::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
if ((w > 0) && (w < 64) && (h > 0) && (h < 64)) {
memcpy(_cursorImage, buf, w * h);
_cursorW = w;
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/ds/arm9/source/osystem_ds.h
Expand Up @@ -114,7 +114,7 @@ class OSystem_DS : public EventsBaseBackend, public PaletteManager {
virtual bool showMouse(bool visible);

virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format);

virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/iphone/osys_main.h
Expand Up @@ -161,7 +161,7 @@ class OSystem_IPHONE : public EventsBaseBackend, public PaletteManager {
virtual bool showMouse(bool visible);

virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor = 255, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);

virtual bool pollEvent(Common::Event &event);
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/iphone/osys_video.mm
Expand Up @@ -399,7 +399,7 @@
}
}

void OSystem_IPHONE::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
void OSystem_IPHONE::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
//printf("setMouseCursor(%p, %u, %u, %i, %i, %u, %d, %p)\n", (const void *)buf, w, h, hotspotX, hotspotY, keycolor, dontScale, (const void *)format);

const Graphics::PixelFormat pixelFormat = format ? *format : Graphics::PixelFormat::createFormatCLUT8();
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/n64/osys_n64.h
Expand Up @@ -182,7 +182,7 @@ class OSystem_N64 : public EventsBaseBackend, public PaletteManager {
virtual bool showMouse(bool visible);

virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);

virtual bool pollEvent(Common::Event &event);
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/n64/osys_n64_base.cpp
Expand Up @@ -774,7 +774,7 @@ void OSystem_N64::warpMouse(int x, int y) {
_dirtyOffscreen = true;
}

void OSystem_N64::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
void OSystem_N64::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
if (!w || !h) return;

_mouseHotspotX = hotspotX;
Expand Down
4 changes: 2 additions & 2 deletions backends/platform/ps2/systemps2.cpp
Expand Up @@ -618,8 +618,8 @@ void OSystem_PS2::warpMouse(int x, int y) {
_screen->setMouseXy(x, y);
}

void OSystem_PS2::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
_screen->setMouseOverlay(buf, w, h, hotspot_x, hotspot_y, keycolor);
void OSystem_PS2::setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
_screen->setMouseOverlay((const byte *)buf, w, h, hotspot_x, hotspot_y, keycolor);
}

void OSystem_PS2::showOverlay(void) {
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/ps2/systemps2.h
Expand Up @@ -80,7 +80,7 @@ class OSystem_PS2 : public EventsBaseBackend, public PaletteManager {
virtual bool showMouse(bool visible);

virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = 0);
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = 0);

virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
Expand Down
4 changes: 2 additions & 2 deletions backends/platform/psp/osys_psp.cpp
Expand Up @@ -303,7 +303,7 @@ void OSystem_PSP::warpMouse(int x, int y) {
_cursor.setXY(x, y);
}

void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
void OSystem_PSP::setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
DEBUG_ENTER_FUNC();
_displayManager.waitUntilRenderFinished();
_pendingUpdate = false;
Expand All @@ -320,7 +320,7 @@ void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
_cursor.setSizeAndScummvmPixelFormat(w, h, format);
_cursor.setHotspot(hotspotX, hotspotY);
_cursor.clearKeyColor();
_cursor.copyFromArray(buf);
_cursor.copyFromArray((const byte *)buf);
}

bool OSystem_PSP::pollEvent(Common::Event &event) {
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/psp/osys_psp.h
Expand Up @@ -118,7 +118,7 @@ class OSystem_PSP : public EventsBaseBackend, public PaletteManager {
// Mouse related
bool showMouse(bool visible);
void warpMouse(int x, int y);
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format);

// Events and input
bool pollEvent(Common::Event &event);
Expand Down
2 changes: 1 addition & 1 deletion backends/platform/wii/osystem.h
Expand Up @@ -187,7 +187,7 @@ class OSystem_Wii : public EventsBaseBackend, public PaletteManager {
virtual bool showMouse(bool visible);

virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
int hotspotY, uint32 keycolor,
bool dontScale,
const Graphics::PixelFormat *format);
Expand Down
12 changes: 6 additions & 6 deletions backends/platform/wii/osystem_gfx.cpp
Expand Up @@ -643,7 +643,7 @@ void OSystem_Wii::warpMouse(int x, int y) {
_mouseY = y;
}

void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
void OSystem_Wii::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
int hotspotY, uint32 keycolor,
bool dontScale,
const Graphics::PixelFormat *format) {
Expand Down Expand Up @@ -686,7 +686,7 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
tmpBuf = true;

if (!tmpBuf) {
gfx_tex_convert(&_texMouse, buf);
gfx_tex_convert(&_texMouse, (const byte *)buf);
} else {
u8 bpp = _texMouse.bpp >> 3;
byte *tmp = (byte *) malloc(tw * th * bpp);
Expand All @@ -703,7 +703,7 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,

#ifdef USE_RGB_COLOR
if (bpp > 1) {
if (!Graphics::crossBlit(tmp, buf,
if (!Graphics::crossBlit(tmp, (const byte *)buf,
tw * _pfRGB3444.bytesPerPixel,
w * _pfCursor.bytesPerPixel,
tw, th, _pfRGB3444, _pfCursor)) {
Expand All @@ -727,10 +727,10 @@ void OSystem_Wii::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX,
} else {
#endif
byte *dst = tmp;

const byte *src = (const byte *)buf;
do {
memcpy(dst, buf, w * bpp);
buf += w * bpp;
memcpy(dst, src, w * bpp);
src += w * bpp;
dst += tw * bpp;
} while (--h);
#ifdef USE_RGB_COLOR
Expand Down
2 changes: 1 addition & 1 deletion common/system.h
Expand Up @@ -874,7 +874,7 @@ class OSystem : Common::NonCopyable {
* would be too small to notice otherwise, these are allowed to scale the cursor anyway.
* @param format pointer to the pixel format which cursor graphic uses (0 means CLUT8)
*/
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0;
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL) = 0;

/**
* Replace the specified range of cursor the palette with new colors.
Expand Down

0 comments on commit d27d951

Please sign in to comment.