From 31880186e1c78023e2e552a7fceaa27c3d2d08b1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 16 Jun 2012 02:18:01 +0200 Subject: BACKENDS: Let copyRectToScreen take a "const void *" instead of "const byte *" as buffer. This removes the need to convert the parameter to copyRectToScreen to "const byte *", which is commonly used in games, which use Graphics::Surface to store their graphics data. --- backends/platform/android/android.h | 2 +- backends/platform/android/gfx.cpp | 2 +- backends/platform/dc/dc.h | 2 +- backends/platform/dc/display.cpp | 7 ++++--- backends/platform/ds/arm9/source/osystem_ds.cpp | 2 +- backends/platform/ds/arm9/source/osystem_ds.h | 2 +- backends/platform/iphone/osys_main.h | 2 +- backends/platform/iphone/osys_video.mm | 13 +++++++------ backends/platform/n64/osys_n64.h | 2 +- backends/platform/n64/osys_n64_base.cpp | 15 ++++++++------- backends/platform/ps2/systemps2.cpp | 2 +- backends/platform/ps2/systemps2.h | 2 +- backends/platform/psp/osys_psp.cpp | 4 ++-- backends/platform/psp/osys_psp.h | 2 +- backends/platform/wii/osystem.h | 2 +- backends/platform/wii/osystem_gfx.cpp | 9 +++++---- 16 files changed, 37 insertions(+), 33 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index 4dad1ee7ed..bf66270a7a 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -244,7 +244,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 304031b4ba..a40a9e2ee9 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -421,7 +421,7 @@ void OSystem_Android::grabPalette(byte *colors, uint start, uint num) { pf.colorToRGB(READ_UINT16(p), colors[0], colors[1], colors[2]); } -void OSystem_Android::copyRectToScreen(const byte *buf, int pitch, +void OSystem_Android::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { ENTER("%p, %d, %d, %d, %d, %d", buf, pitch, x, y, w, h); diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index ffe003ea1d..95cb88c44b 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -127,7 +127,7 @@ public: // Draw a bitmap to screen. // The screen will not be updated to reflect the new bitmap - void copyRectToScreen(const byte *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); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index e4e9a94ec8..264b86646c 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -260,7 +260,7 @@ void OSystem_Dreamcast::initSize(uint w, uint h, const Graphics::PixelFormat *fo _devpoll = Timer(); } -void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int y, +void OSystem_Dreamcast::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { if (w<1 || h<1) @@ -269,10 +269,11 @@ void OSystem_Dreamcast::copyRectToScreen(const byte *buf, int pitch, int x, int x<<=1; w<<=1; } unsigned char *dst = screen + y*SCREEN_W*2 + x; + const byte *src = (const byte *)buf; do { - memcpy(dst, buf, w); + memcpy(dst, src, w); dst += SCREEN_W*2; - buf += pitch; + src += pitch; } while (--h); _screen_dirty = true; } diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index a6b85f207f..f91342a6ce 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -280,7 +280,7 @@ void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) { #define MISALIGNED16(ptr) (((u32) (ptr) & 1) != 0) -void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_DS::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { if (!_graphicsEnable) return; if (w <= 1) return; if (h < 0) return; diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 11b0988666..789053e522 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -98,7 +98,7 @@ protected: public: void restoreHardwarePalette(); - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual void setShakePos(int shakeOffset); diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index e06c7973ab..da3864e0df 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -143,7 +143,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm index ddfa8f5030..387d91ff57 100644 --- a/backends/platform/iphone/osys_video.mm +++ b/backends/platform/iphone/osys_video.mm @@ -161,18 +161,19 @@ void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) { } } -void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_IPHONE::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { //printf("copyRectToScreen(%p, %d, %i, %i, %i, %i)\n", buf, pitch, x, y, w, h); //Clip the coordinates + const byte *src = (const byte *)buf; if (x < 0) { w += x; - buf -= x; + src -= x; x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -193,11 +194,11 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, byte *dst = (byte *)_framebuffer.getBasePtr(x, y); if (_framebuffer.pitch == pitch && _framebuffer.w == w) { - memcpy(dst, buf, h * pitch); + memcpy(dst, src, h * pitch); } else { do { - memcpy(dst, buf, w * _framebuffer.format.bytesPerPixel); - buf += pitch; + memcpy(dst, src, w * _framebuffer.format.bytesPerPixel); + src += pitch; dst += _framebuffer.pitch; } while (--h); } diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index b8519eeea6..8e28dc9c98 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -162,7 +162,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index f36f7399e1..d8956404f5 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -442,17 +442,18 @@ void OSystem_N64::setCursorPalette(const byte *colors, uint start, uint num) { _dirtyOffscreen = true; } -void OSystem_N64::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_N64::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { //Clip the coordinates + const byte *src = (const byte *)buf; if (x < 0) { w += x; - buf -= x; + src -= x; x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -472,14 +473,14 @@ void OSystem_N64::copyRectToScreen(const byte *buf, int pitch, int x, int y, int do { for (int hor = 0; hor < w; hor++) { - if (dst_pal[hor] != buf[hor]) { - uint16 color = _screenPalette[buf[hor]]; + if (dst_pal[hor] != src[hor]) { + uint16 color = _screenPalette[src[hor]]; dst_hicol[hor] = color; // Save image converted to 16-bit - dst_pal[hor] = buf[hor]; // Save palettized display + dst_pal[hor] = src[hor]; // Save palettized display } } - buf += pitch; + src += pitch; dst_pal += _screenWidth; dst_hicol += _screenWidth; } while (--h); diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 668ac93a07..9413c55062 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -554,7 +554,7 @@ void OSystem_PS2::grabPalette(byte *colors, uint start, uint num) { _screen->grabPalette(colors, (uint8)start, (uint16)num); } -void OSystem_PS2::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_PS2::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { _screen->copyScreenRect((const uint8*)buf, pitch, x, y, w, h); } diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index 7bbe061e42..d167988334 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -62,7 +62,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void setShakePos(int shakeOffset); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 958a3a22c6..46e11b1bf7 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -204,11 +204,11 @@ void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) { _cursor.clearKeyColor(); // Do we need this? } -void OSystem_PSP::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_PSP::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { DEBUG_ENTER_FUNC(); _displayManager.waitUntilRenderFinished(); _pendingUpdate = false; - _screen.copyFromRect(buf, pitch, x, y, w, h); + _screen.copyFromRect((const byte *)buf, pitch, x, y, w, h); } Graphics::Surface *OSystem_PSP::lockScreen() { diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index c72053f52c..af01b6f6c8 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -99,7 +99,7 @@ public: void setCursorPalette(const byte *colors, uint start, uint num); // Screen related - void copyRectToScreen(const byte *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); Graphics::Surface *lockScreen(); void unlockScreen(); void updateScreen(); diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index b6784d59e4..75c19e6f1b 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -167,7 +167,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: virtual void setCursorPalette(const byte *colors, uint start, uint num); - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index a00cea8252..c2b6553bac 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -395,7 +395,7 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) { _cursorPaletteDirty = true; } -void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y, +void OSystem_Wii::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { assert(x >= 0 && x < _gameWidth); assert(y >= 0 && y < _gameHeight); @@ -407,7 +407,7 @@ void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y, if (!Graphics::crossBlit(_gamePixels + y * _gameWidth * _pfGame.bytesPerPixel + x * _pfGame.bytesPerPixel, - buf, _gameWidth * _pfGame.bytesPerPixel, + (const byte *)buf, _gameWidth * _pfGame.bytesPerPixel, pitch, w, h, _pfGameTexture, _pfGame)) { printf("crossBlit failed\n"); ::abort(); @@ -418,9 +418,10 @@ void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y, if (_gameWidth == pitch && pitch == w) { memcpy(dst, buf, h * w); } else { + const byte *src = (const byte *)buf; do { - memcpy(dst, buf, w); - buf += pitch; + memcpy(dst, src, w); + src += pitch; dst += _gameWidth; } while (--h); } -- cgit v1.2.3 From d27d951d0b079a301ea1c6a3731bc1fc83234cff Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 16 Jun 2012 03:10:43 +0200 Subject: BACKENDS: Make OSystem::setMouseCursor take a "const void *" buffer. This is mainly for consistency with OSystem::copyRectToScreen. --- backends/platform/android/android.h | 2 +- backends/platform/android/gfx.cpp | 4 ++-- backends/platform/dc/dc.h | 2 +- backends/platform/dc/display.cpp | 2 +- backends/platform/ds/arm9/source/osystem_ds.cpp | 2 +- backends/platform/ds/arm9/source/osystem_ds.h | 2 +- backends/platform/iphone/osys_main.h | 2 +- backends/platform/iphone/osys_video.mm | 2 +- backends/platform/n64/osys_n64.h | 2 +- backends/platform/n64/osys_n64_base.cpp | 2 +- backends/platform/ps2/systemps2.cpp | 4 ++-- backends/platform/ps2/systemps2.h | 2 +- backends/platform/psp/osys_psp.cpp | 4 ++-- backends/platform/psp/osys_psp.h | 2 +- backends/platform/wii/osystem.h | 2 +- backends/platform/wii/osystem_gfx.cpp | 12 ++++++------ 16 files changed, 24 insertions(+), 24 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index bf66270a7a..ce51baec3d 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -267,7 +267,7 @@ public: 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); diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index a40a9e2ee9..1241667533 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -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) { @@ -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"); diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index 95cb88c44b..aa2a3709cb 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -142,7 +142,7 @@ public: 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); diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index 264b86646c..35e7b70a82 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -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) { diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index f91342a6ce..b4bf38c45b 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -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; diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index 789053e522..d35b16c8fd 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -114,7 +114,7 @@ public: 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(); diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index da3864e0df..b15b5e0375 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -161,7 +161,7 @@ public: 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); diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm index 387d91ff57..1649956a6c 100644 --- a/backends/platform/iphone/osys_video.mm +++ b/backends/platform/iphone/osys_video.mm @@ -399,7 +399,7 @@ void OSystem_IPHONE::dirtyFullOverlayScreen() { } } -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(); diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index 8e28dc9c98..121f84f93f 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -182,7 +182,7 @@ public: 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); diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index d8956404f5..b526c68762 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -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; diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 9413c55062..a639725d78 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -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) { diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index d167988334..efbe7d5f93 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -80,7 +80,7 @@ public: 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); diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 46e11b1bf7..3fe9a7f9c7 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -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; @@ -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) { diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index af01b6f6c8..d167c757ae 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -118,7 +118,7 @@ public: // 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); diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index 75c19e6f1b..ecd69178bb 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -187,7 +187,7 @@ public: 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); diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index c2b6553bac..741acd4f4a 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -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) { @@ -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); @@ -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)) { @@ -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 -- cgit v1.2.3 From aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 16 Jun 2012 04:17:14 +0200 Subject: ALL: Let overlay related methods in OSystem take a void * and use a proper pitch values. This is a first step to get rid of OverlayColor, which is a requirement for proper 4Bpp overlay support. --- backends/platform/android/android.h | 4 ++-- backends/platform/android/gfx.cpp | 13 ++++++------- backends/platform/dc/dc.h | 4 ++-- backends/platform/dc/display.cpp | 14 ++++++++------ backends/platform/ds/arm9/source/osystem_ds.cpp | 12 ++++++------ backends/platform/ds/arm9/source/osystem_ds.h | 4 ++-- backends/platform/iphone/osys_main.h | 4 ++-- backends/platform/iphone/osys_video.mm | 18 ++++++++++-------- backends/platform/n64/osys_n64.h | 4 ++-- backends/platform/n64/osys_n64_base.cpp | 20 +++++++++++--------- backends/platform/ps2/Gs2dScreen.cpp | 4 ++-- backends/platform/ps2/Gs2dScreen.h | 4 ++-- backends/platform/ps2/systemps2.cpp | 8 ++++---- backends/platform/ps2/systemps2.h | 4 ++-- backends/platform/psp/default_display_client.cpp | 8 ++++---- backends/platform/psp/default_display_client.h | 4 ++-- backends/platform/psp/osys_psp.cpp | 4 ++-- backends/platform/psp/osys_psp.h | 4 ++-- backends/platform/wii/osystem.h | 4 ++-- backends/platform/wii/osystem_gfx.cpp | 20 +++++++++++--------- 20 files changed, 84 insertions(+), 77 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h index ce51baec3d..4b13ca4b0f 100644 --- a/backends/platform/android/android.h +++ b/backends/platform/android/android.h @@ -257,8 +257,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 1241667533..44046cb1c1 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -636,7 +636,7 @@ void OSystem_Android::clearOverlay() { _overlay_texture->fillBuffer(0); } -void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_Android::grabOverlay(void *buf, int pitch) { ENTER("%p, %d", buf, pitch); GLTHREADCHECK; @@ -644,25 +644,24 @@ void OSystem_Android::grabOverlay(OverlayColor *buf, int pitch) { const Graphics::Surface *surface = _overlay_texture->surface_const(); assert(surface->format.bytesPerPixel == sizeof(buf[0])); + byte *dst = (byte *)buf; const byte *src = (const byte *)surface->pixels; uint h = surface->h; do { - memcpy(buf, src, surface->w * surface->format.bytesPerPixel); + memcpy(dst, src, surface->w * surface->format.bytesPerPixel); src += surface->pitch; - // This 'pitch' is pixels not bytes - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_Android::copyRectToOverlay(const OverlayColor *buf, int pitch, +void OSystem_Android::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { ENTER("%p, %d, %d, %d, %d, %d", buf, pitch, x, y, w, h); GLTHREADCHECK; - // This 'pitch' is pixels not bytes - _overlay_texture->updateBuffer(x, y, w, h, buf, pitch * sizeof(buf[0])); + _overlay_texture->updateBuffer(x, y, w, h, buf, pitch); } int16 OSystem_Android::getOverlayHeight() { diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index aa2a3709cb..d41839d961 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -172,8 +172,8 @@ public: void showOverlay(); void hideOverlay(); void clearOverlay(); - void grabOverlay(OverlayColor *buf, int pitch); - void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + void grabOverlay(void *buf, int pitch); + void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); } // Mutex handling diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index 35e7b70a82..cc5798fc10 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -653,27 +653,29 @@ void OSystem_Dreamcast::clearOverlay() _overlay_dirty = true; } -void OSystem_Dreamcast::grabOverlay(OverlayColor *buf, int pitch) +void OSystem_Dreamcast::grabOverlay(void *buf, int pitch) { int h = OVL_H; unsigned short *src = overlay; + unsigned char *dst = (unsigned char *)buf; do { - memcpy(buf, src, OVL_W*sizeof(int16)); + memcpy(dst, src, OVL_W*sizeof(int16)); src += OVL_W; - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_Dreamcast::copyRectToOverlay(const OverlayColor *buf, int pitch, +void OSystem_Dreamcast::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { if (w<1 || h<1) return; unsigned short *dst = overlay + y*OVL_W + x; + const unsigned char *src = (const unsigned char *)buf; do { - memcpy(dst, buf, w*sizeof(int16)); + memcpy(dst, src, w*sizeof(int16)); dst += OVL_W; - buf += pitch; + src += pitch; } while (--h); _overlay_dirty = true; } diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index b4bf38c45b..5c20deb359 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.cpp +++ b/backends/platform/ds/arm9/source/osystem_ds.cpp @@ -509,13 +509,13 @@ void OSystem_DS::clearOverlay() { // consolePrintf("clearovl\n"); } -void OSystem_DS::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_DS::grabOverlay(void *buf, int pitch) { // consolePrintf("grabovl\n") u16 *start = DS::get16BitBackBuffer(); for (int y = 0; y < 200; y++) { u16 *src = start + (y * 320); - u16 *dest = ((u16 *) (buf)) + (y * pitch); + u16 *dest = (u16 *)((u8 *)buf + (y * pitch)); for (int x = 0; x < 320; x++) { *dest++ = *src++; @@ -524,9 +524,9 @@ void OSystem_DS::grabOverlay(OverlayColor *buf, int pitch) { } -void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void OSystem_DS::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { u16 *bg = (u16 *) DS::get16BitBackBuffer(); - const u16 *src = (const u16 *) buf; + const u8 *source = (const u8 *)buf; // if (x + w > 256) w = 256 - x; //if (x + h > 256) h = 256 - y; @@ -536,7 +536,7 @@ void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, in for (int dy = y; dy < y + h; dy++) { - + const u16 *src = (const u16 *)source; // Slow but save copy: for (int dx = x; dx < x + w; dx++) { @@ -546,7 +546,7 @@ void OSystem_DS::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, in //consolePrintf("%d,", *src); src++; } - src += (pitch - w); + source += pitch; // Fast but broken copy: (why?) /* diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h index d35b16c8fd..a6001da764 100644 --- a/backends/platform/ds/arm9/source/osystem_ds.h +++ b/backends/platform/ds/arm9/source/osystem_ds.h @@ -105,8 +105,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); } diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index b15b5e0375..037125490d 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -152,8 +152,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<5551>(); } diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm index 1649956a6c..b01c925024 100644 --- a/backends/platform/iphone/osys_video.mm +++ b/backends/platform/iphone/osys_video.mm @@ -309,31 +309,33 @@ void OSystem_IPHONE::clearOverlay() { dirtyFullOverlayScreen(); } -void OSystem_IPHONE::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_IPHONE::grabOverlay(void *buf, int pitch) { //printf("grabOverlay()\n"); int h = _videoContext->overlayHeight; + byte *dst = (byte *)buf; const byte *src = (const byte *)_videoContext->overlayTexture.getBasePtr(0, 0); do { - memcpy(buf, src, _videoContext->overlayWidth * sizeof(OverlayColor)); + memcpy(dst, src, _videoContext->overlayWidth * sizeof(OverlayColor)); src += _videoContext->overlayTexture.pitch; - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void OSystem_IPHONE::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { //printf("copyRectToOverlay(%p, pitch=%i, x=%i, y=%i, w=%i, h=%i)\n", (const void *)buf, pitch, x, y, w, h); + const byte *src = (const byte *)buf; //Clip the coordinates if (x < 0) { w += x; - buf -= x; + src -= x * sizeof(OverlayColor); x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -352,8 +354,8 @@ void OSystem_IPHONE::copyRectToOverlay(const OverlayColor *buf, int pitch, int x byte *dst = (byte *)_videoContext->overlayTexture.getBasePtr(x, y); do { - memcpy(dst, buf, w * sizeof(OverlayColor)); - buf += pitch; + memcpy(dst, src, w * sizeof(OverlayColor)); + src += pitch; dst += _videoContext->overlayTexture.pitch; } while (--h); } diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index 121f84f93f..3266180a7b 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -171,8 +171,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayHeight(); virtual int16 getOverlayWidth(); virtual Graphics::PixelFormat getOverlayFormat() const { diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp index b526c68762..ed2badb305 100644 --- a/backends/platform/n64/osys_n64_base.cpp +++ b/backends/platform/n64/osys_n64_base.cpp @@ -683,28 +683,30 @@ void OSystem_N64::clearOverlay() { _dirtyOffscreen = true; } -void OSystem_N64::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_N64::grabOverlay(void *buf, int pitch) { int h = _overlayHeight; OverlayColor *src = _overlayBuffer; + byte *dst = (byte *)buf; do { - memcpy(buf, src, _overlayWidth * sizeof(OverlayColor)); + memcpy(dst, src, _overlayWidth * sizeof(OverlayColor)); src += _overlayWidth; - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_N64::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void OSystem_N64::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { + const byte *src = (const byte *)buf; //Clip the coordinates if (x < 0) { w += x; - buf -= x; + src -= x * sizeof(OverlayColor); x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -723,11 +725,11 @@ void OSystem_N64::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, i OverlayColor *dst = _overlayBuffer + (y * _overlayWidth + x); if (_overlayWidth == pitch && pitch == w) { - memcpy(dst, buf, h * w * sizeof(OverlayColor)); + memcpy(dst, src, h * w * sizeof(OverlayColor)); } else { do { - memcpy(dst, buf, w * sizeof(OverlayColor)); - buf += pitch; + memcpy(dst, src, w * sizeof(OverlayColor)); + src += pitch; dst += _overlayWidth; } while (--h); } diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 8df6198c38..f93166ef67 100644 --- a/backends/platform/ps2/Gs2dScreen.cpp +++ b/backends/platform/ps2/Gs2dScreen.cpp @@ -564,7 +564,7 @@ void Gs2dScreen::clearPrintfOverlay(void) { free(tmpBuf); } -void Gs2dScreen::copyOverlayRect(const uint16 *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h) { +void Gs2dScreen::copyOverlayRect(const byte *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h) { WaitSema(g_DmacSema); // warning("_overlayBuf [dst] = %x", _overlayBuf); @@ -601,7 +601,7 @@ void Gs2dScreen::clearOverlay(void) { SignalSema(g_DmacSema); } -void Gs2dScreen::grabOverlay(uint16 *buf, uint16 pitch) { +void Gs2dScreen::grabOverlay(byte *buf, uint16 pitch) { uint16 *src = _overlayBuf; for (uint32 cnt = 0; cnt < _height; cnt++) { memcpy(buf, src, _width * 2); diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h index 4fbb3fdef8..005dabc809 100644 --- a/backends/platform/ps2/Gs2dScreen.h +++ b/backends/platform/ps2/Gs2dScreen.h @@ -62,8 +62,8 @@ public: void updateScreen(void); void grabPalette(uint8 *pal, uint8 start, uint16 num); //- overlay routines - void copyOverlayRect(const uint16 *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h); - void grabOverlay(uint16 *buf, uint16 pitch); + void copyOverlayRect(const byte *buf, uint16 pitch, uint16 x, uint16 y, uint16 w, uint16 h); + void grabOverlay(byte *buf, uint16 pitch); void clearOverlay(void); void showOverlay(void); void hideOverlay(void); diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index a639725d78..5628658381 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -634,12 +634,12 @@ void OSystem_PS2::clearOverlay(void) { _screen->clearOverlay(); } -void OSystem_PS2::grabOverlay(OverlayColor *buf, int pitch) { - _screen->grabOverlay((uint16 *)buf, (uint16)pitch); +void OSystem_PS2::grabOverlay(void *buf, int pitch) { + _screen->grabOverlay((byte *)buf, (uint16)pitch); } -void OSystem_PS2::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { - _screen->copyOverlayRect((const uint16*)buf, (uint16)pitch, (uint16)x, (uint16)y, (uint16)w, (uint16)h); +void OSystem_PS2::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { + _screen->copyOverlayRect((const byte *)buf, (uint16)pitch, (uint16)x, (uint16)y, (uint16)w, (uint16)h); } Graphics::PixelFormat OSystem_PS2::getOverlayFormat(void) const { diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index efbe7d5f93..99482d4da4 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -72,8 +72,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayWidth(void); virtual int16 getOverlayHeight(void); diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp index 2ee7ff5b74..bc252144fa 100644 --- a/backends/platform/psp/default_display_client.cpp +++ b/backends/platform/psp/default_display_client.cpp @@ -123,15 +123,15 @@ void Overlay::setSize(uint32 width, uint32 height) { _renderer.setDrawWholeBuffer(); // We need to let the renderer know how much to draw } -void Overlay::copyToArray(OverlayColor *buf, int pitch) { +void Overlay::copyToArray(void *buf, int pitch) { DEBUG_ENTER_FUNC(); - _buffer.copyToArray((byte *)buf, pitch * sizeof(OverlayColor)); // Change to bytes + _buffer.copyToArray((byte *)buf, pitch); // Change to bytes } -void Overlay::copyFromRect(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void Overlay::copyFromRect(const void *buf, int pitch, int x, int y, int w, int h) { DEBUG_ENTER_FUNC(); - _buffer.copyFromRect((byte *)buf, pitch * sizeof(OverlayColor), x, y, w, h); // Change to bytes + _buffer.copyFromRect((byte *)buf, pitch, x, y, w, h); // Change to bytes // debug //_buffer.print(0xFF); setDirty(); diff --git a/backends/platform/psp/default_display_client.h b/backends/platform/psp/default_display_client.h index 721a7e6fea..95c52e2352 100644 --- a/backends/platform/psp/default_display_client.h +++ b/backends/platform/psp/default_display_client.h @@ -69,8 +69,8 @@ public: bool allocate(); void setBytesPerPixel(uint32 size); void setSize(uint32 width, uint32 height); - void copyToArray(OverlayColor *buf, int pitch); - void copyFromRect(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + void copyToArray(void *buf, int pitch); + void copyFromRect(const void *buf, int pitch, int x, int y, int w, int h); }; /** diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 3fe9a7f9c7..0032fea072 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -260,12 +260,12 @@ void OSystem_PSP::clearOverlay() { _overlay.clearBuffer(); } -void OSystem_PSP::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_PSP::grabOverlay(void *buf, int pitch) { DEBUG_ENTER_FUNC(); _overlay.copyToArray(buf, pitch); } -void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { +void OSystem_PSP::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { DEBUG_ENTER_FUNC(); _displayManager.waitUntilRenderFinished(); _pendingUpdate = false; diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h index d167c757ae..2afdabd0fc 100644 --- a/backends/platform/psp/osys_psp.h +++ b/backends/platform/psp/osys_psp.h @@ -109,8 +109,8 @@ public: void showOverlay(); void hideOverlay(); void clearOverlay(); - void grabOverlay(OverlayColor *buf, int pitch); - void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); + void grabOverlay(void *buf, int pitch); + void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); int16 getOverlayHeight(); int16 getOverlayWidth(); Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<4444>(); } diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h index ecd69178bb..f1c8d77533 100644 --- a/backends/platform/wii/osystem.h +++ b/backends/platform/wii/osystem.h @@ -177,8 +177,8 @@ public: virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); - virtual void grabOverlay(OverlayColor *buf, int pitch); - virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, + virtual void grabOverlay(void *buf, int pitch); + virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h); virtual int16 getOverlayWidth(); virtual int16 getOverlayHeight(); diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index 741acd4f4a..6b0e31bd7b 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -571,28 +571,30 @@ void OSystem_Wii::clearOverlay() { _overlayDirty = true; } -void OSystem_Wii::grabOverlay(OverlayColor *buf, int pitch) { +void OSystem_Wii::grabOverlay(void *buf, int pitch) { int h = _overlayHeight; OverlayColor *src = _overlayPixels; + byte *dst = (byte *)buf; do { - memcpy(buf, src, _overlayWidth * sizeof(OverlayColor)); + memcpy(dst, src, _overlayWidth * sizeof(OverlayColor)); src += _overlayWidth; - buf += pitch; + dst += pitch; } while (--h); } -void OSystem_Wii::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, +void OSystem_Wii::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { + const byte *src = (const byte *)buf; if (x < 0) { w += x; - buf -= x; + src -= x * sizeof(OverlayColor); x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -607,11 +609,11 @@ void OSystem_Wii::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, OverlayColor *dst = _overlayPixels + (y * _overlayWidth + x); if (_overlayWidth == pitch && pitch == w) { - memcpy(dst, buf, h * w * sizeof(OverlayColor)); + memcpy(dst, src, h * w * sizeof(OverlayColor)); } else { do { - memcpy(dst, buf, w * sizeof(OverlayColor)); - buf += pitch; + memcpy(dst, src, w * sizeof(OverlayColor)); + src += pitch; dst += _overlayWidth; } while (--h); } -- cgit v1.2.3