aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/wii
diff options
context:
space:
mode:
authorJohannes Schickel2012-06-20 08:02:26 -0700
committerJohannes Schickel2012-06-20 08:02:26 -0700
commit4fb9bceabc4309a477472aa55207eae55bc0aa13 (patch)
tree1e119f6d63d0a4c5c38a7caabd92be335749f07d /backends/platform/wii
parent5a2e65469f3650dc9785bf27b77d25d285ded4f1 (diff)
parentaec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95 (diff)
downloadscummvm-rg350-4fb9bceabc4309a477472aa55207eae55bc0aa13.tar.gz
scummvm-rg350-4fb9bceabc4309a477472aa55207eae55bc0aa13.tar.bz2
scummvm-rg350-4fb9bceabc4309a477472aa55207eae55bc0aa13.zip
Merge pull request #246 from lordhoto/osystem-void-buffers
OSYSTEM: Use void buffers for screen/overlay/mouse buffers and proper pitch values for overlay code
Diffstat (limited to 'backends/platform/wii')
-rw-r--r--backends/platform/wii/osystem.h8
-rw-r--r--backends/platform/wii/osystem_gfx.cpp41
2 files changed, 26 insertions, 23 deletions
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index b6784d59e4..f1c8d77533 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();
@@ -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();
@@ -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 a00cea8252..6b0e31bd7b 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);
}
@@ -570,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;
}
@@ -606,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);
}
@@ -642,7 +645,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) {
@@ -685,7 +688,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);
@@ -702,7 +705,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)) {
@@ -726,10 +729,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