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/n64/osys_n64_base.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'backends/platform/n64/osys_n64_base.cpp') 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); } -- cgit v1.2.3