diff options
Diffstat (limited to 'backends/platform/wii/osystem_gfx.cpp')
-rw-r--r-- | backends/platform/wii/osystem_gfx.cpp | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp index a00cea8252..90e4d98c6b 100644 --- a/backends/platform/wii/osystem_gfx.cpp +++ b/backends/platform/wii/osystem_gfx.cpp @@ -74,7 +74,7 @@ void OSystem_Wii::initGfx() { #endif _overlaySize = _overlayWidth * _overlayHeight * 2; - _overlayPixels = (OverlayColor *) memalign(32, _overlaySize); + _overlayPixels = (uint16 *) memalign(32, _overlaySize); memset(&_texMouse, 0, sizeof(gfx_tex_t)); memset(&_texOverlay, 0, sizeof(gfx_tex_t)); @@ -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; + uint16 *src = _overlayPixels; + byte *dst = (byte *)buf; do { - memcpy(buf, src, _overlayWidth * sizeof(OverlayColor)); + memcpy(dst, src, _overlayWidth * sizeof(uint16)); 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(uint16); x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -604,13 +607,13 @@ void OSystem_Wii::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, if (w <= 0 || h <= 0) return; - OverlayColor *dst = _overlayPixels + (y * _overlayWidth + x); - if (_overlayWidth == pitch && pitch == w) { - memcpy(dst, buf, h * w * sizeof(OverlayColor)); + uint16 *dst = _overlayPixels + (y * _overlayWidth + x); + if (_overlayWidth == w && pitch == _overlayWidth * sizeof(uint16)) { + memcpy(dst, src, h * pitch); } else { do { - memcpy(dst, buf, w * sizeof(OverlayColor)); - buf += pitch; + memcpy(dst, src, w * sizeof(uint16)); + 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 |