[Scummvm-cvs-logs] scummvm master -> 4fb9bceabc4309a477472aa55207eae55bc0aa13

lordhoto lordhoto at gmail.com
Wed Jun 20 17:03:17 CEST 2012


This automated email contains information about 25 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
31880186e1 BACKENDS: Let copyRectToScreen take a "const void *" instead of "const byte *" as buffer.
d4a5615a8b CGE: Get rid of casts on OSystem::copyRectToScreen calls.
2afc0a5fbc GROOVIE: Get rid of casts on OSystem::copyRectToScreen calls.
2e97e043fb LASTEXPRESS: Get rid of casts on OSystem::copyRectToScreen calls.
79dfc7be97 MADE: Get rid of casts on OSystem::copyRectToScreen calls.
d214391431 MOHAWK: Get rid of casts on OSystem::copyRectToScreen calls.
ebb5cb7e4c SAGA: Get rid of casts on OSystem::copyRectToScreen calls.
084c1259fc SCI: Get rid of casts on OSystem::copyRectToScreen calls.
64790aabc8 SCUMM: Get rid of casts on OSystem::copyRectToScreen calls.
d8aff72402 SWORD1: Get rid of casts on OSystem::copyRectToScreen calls.
5f65cf9679 SWORD25: Get rid of casts on OSystem::copyRectToScreen calls.
808e41d807 SWORD2: Get rid of casts on OSystem::copyRectToScreen calls.
f3c66a191f TEENAGENT: Get rid of casts on OSystem::copyRectToScreen calls.
72f1fb0bed TOLTECS: Get rid of casts on OSystem::copyRectToScreen calls.
58bf8090cc TOON: Get rid of casts on OSystem::copyRectToScreen calls.
d27d951d0b BACKENDS: Make OSystem::setMouseCursor take a "const void *" buffer.
e1e1f01b87 GRAPHICS: Let CursorMan's cursor functions take "const void *" buffers.
0268f21980 DRASCULA: Get rid of casts on CursorManager::replaceCursor calls.
1cda4f903b LASTEXPRESS: Get rid of casts on CursorManager::replaceCursor calls.
57e0381b62 MADE: Get rid of casts on CursorManager::replaceCursor calls.
60a6ce70c1 MOHAWK: Get rid of casts on CursorManager::replaceCursor calls.
7b646e5c62 SCI: Get rid of casts on CursorManager::replaceCursor calls.
99229fc7ab TOLTECS: Get rid of casts on CursorManager::replaceCursor calls.
aec9b9e22a ALL: Let overlay related methods in OSystem take a void * and use a proper pitch values.
4fb9bceabc Merge pull request #246 from lordhoto/osystem-void-buffers


Commit: 31880186e1c78023e2e552a7fceaa27c3d2d08b1
    https://github.com/scummvm/scummvm/commit/31880186e1c78023e2e552a7fceaa27c3d2d08b1
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:18:01-07:00

Commit Message:
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.

Changed paths:
    backends/graphics/graphics.h
    backends/graphics/null/null-graphics.h
    backends/graphics/opengl/opengl-graphics.cpp
    backends/graphics/opengl/opengl-graphics.h
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h
    backends/graphics/wincesdl/wincesdl-graphics.cpp
    backends/graphics/wincesdl/wincesdl-graphics.h
    backends/modular-backend.cpp
    backends/modular-backend.h
    backends/platform/android/android.h
    backends/platform/android/gfx.cpp
    backends/platform/dc/dc.h
    backends/platform/dc/display.cpp
    backends/platform/ds/arm9/source/osystem_ds.cpp
    backends/platform/ds/arm9/source/osystem_ds.h
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.mm
    backends/platform/n64/osys_n64.h
    backends/platform/n64/osys_n64_base.cpp
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h
    backends/platform/psp/osys_psp.cpp
    backends/platform/psp/osys_psp.h
    backends/platform/wii/osystem.h
    backends/platform/wii/osystem_gfx.cpp
    common/system.h



diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index 0d6fa30..056e894 100644
--- a/backends/graphics/graphics.h
+++ b/backends/graphics/graphics.h
@@ -60,7 +60,7 @@ public:
 	virtual int16 getWidth() = 0;
 	virtual void setPalette(const byte *colors, uint start, uint num) = 0;
 	virtual void grabPalette(byte *colors, uint start, uint num) = 0;
-	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
+	virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) = 0;
 	virtual Graphics::Surface *lockScreen() = 0;
 	virtual void unlockScreen() = 0;
 	virtual void fillScreen(uint32 col) = 0;
diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h
index 2f8baae..6ffe2e8 100644
--- a/backends/graphics/null/null-graphics.h
+++ b/backends/graphics/null/null-graphics.h
@@ -58,7 +58,7 @@ public:
 	int16 getWidth() { return 0; }
 	void setPalette(const byte *colors, uint start, uint num) {}
 	void grabPalette(byte *colors, uint start, uint num) {}
-	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() { return NULL; }
 	void unlockScreen() {}
 	void fillScreen(uint32 col) {}
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 8449048..033814a 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -349,14 +349,14 @@ void OpenGLGraphicsManager::grabPalette(byte *colors, uint start, uint num) {
 	memcpy(colors, _gamePalette + start * 3, num * 3);
 }
 
-void OpenGLGraphicsManager::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void OpenGLGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
 	assert(x >= 0 && x < _screenData.w);
 	assert(y >= 0 && y < _screenData.h);
 	assert(h > 0 && y + h <= _screenData.h);
 	assert(w > 0 && x + w <= _screenData.w);
 
 	// Copy buffer data to game screen internal buffer
-	const byte *src = buf;
+	const byte *src = (const byte *)buf;
 	byte *dst = (byte *)_screenData.pixels + y * _screenData.pitch + x * _screenData.format.bytesPerPixel;
 	for (int i = 0; i < h; i++) {
 		memcpy(dst, src, w * _screenData.format.bytesPerPixel);
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index 956722c..350ffa5 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -84,7 +84,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 Graphics::Surface *lockScreen();
 	virtual void unlockScreen();
 	virtual void fillScreen(uint32 col);
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 652c08d..9244135 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -1227,9 +1227,9 @@ void SurfaceSdlGraphicsManager::setAspectRatioCorrection(bool enable) {
 	}
 }
 
-void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
+void SurfaceSdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
 	assert(_transactionMode == kTransactionNone);
-	assert(src);
+	assert(buf);
 
 	if (_screen == NULL) {
 		warning("SurfaceSdlGraphicsManager::copyRectToScreen: _screen == NULL");
@@ -1252,8 +1252,9 @@ void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int
 #ifdef USE_RGB_COLOR
 	byte *dst = (byte *)_screen->pixels + y * _screen->pitch + x * _screenFormat.bytesPerPixel;
 	if (_videoMode.screenWidth == w && pitch == _screen->pitch) {
-		memcpy(dst, src, h*pitch);
+		memcpy(dst, buf, h*pitch);
 	} else {
+		const byte *src = (const byte *)buf;
 		do {
 			memcpy(dst, src, w * _screenFormat.bytesPerPixel);
 			src += pitch;
@@ -1263,8 +1264,9 @@ void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int
 #else
 	byte *dst = (byte *)_screen->pixels + y * _screen->pitch + x;
 	if (_screen->pitch == pitch && pitch == w) {
-		memcpy(dst, src, h*w);
+		memcpy(dst, buf, h*w);
 	} else {
+		const byte *src = (const byte *)buf;
 		do {
 			memcpy(dst, src, w);
 			src += pitch;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 32fb219..f2b2d7b 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -111,7 +111,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 Graphics::Surface *lockScreen();
 	virtual void unlockScreen();
 	virtual void fillScreen(uint32 col);
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp
index bb79813..2315c58 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.cpp
+++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp
@@ -1071,15 +1071,16 @@ void WINCESdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pit
 	SDL_UnlockSurface(_overlayscreen);
 }
 
-void WINCESdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
+void WINCESdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
 	assert(_transactionMode == kTransactionNone);
-	assert(src);
+	assert(buf);
 
 	if (_screen == NULL)
 		return;
 
 	Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends
 
+	const byte *src = (const byte *)buf;
 	/* Clip the coordinates */
 	if (x < 0) {
 		w += x;
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.h b/backends/graphics/wincesdl/wincesdl-graphics.h
index 7cff8a1..26067f0 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.h
+++ b/backends/graphics/wincesdl/wincesdl-graphics.h
@@ -75,7 +75,7 @@ public:
 	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 copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
-	void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME)
+	void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME)
 	Graphics::Surface *lockScreen();
 	void unlockScreen();
 	void blitCursor();
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index f133c65..2b40876 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -124,7 +124,7 @@ PaletteManager *ModularBackend::getPaletteManager() {
 	return _graphicsManager;
 }
 
-void ModularBackend::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void ModularBackend::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
 	_graphicsManager->copyRectToScreen(buf, pitch, x, y, w, h);
 }
 
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index 150c12c..fd4aca2 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -80,7 +80,7 @@ public:
 	virtual int16 getHeight();
 	virtual int16 getWidth();
 	virtual PaletteManager *getPaletteManager();
-	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 Graphics::Surface *lockScreen();
 	virtual void unlockScreen();
 	virtual void fillScreen(uint32 col);
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 4dad1ee..bf66270 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 304031b..a40a9e2 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 ffe003e..95cb88c 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 e4e9a94..264b866 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 a6b85f2..f91342a 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 11b0988..789053e 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 e06c797..da3864e 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 ddfa8f5..387d91f 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 b8519ee..8e28dc9 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 f36f739..d895640 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 668ac93..9413c55 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 7bbe061..d167988 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 958a3a2..46e11b1 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 c72053f..af01b6f 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 b6784d5..75c19e6 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 a00cea8..c2b6553 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);
 		}
diff --git a/common/system.h b/common/system.h
index 94bf7f0..f35c09c 100644
--- a/common/system.h
+++ b/common/system.h
@@ -657,7 +657,7 @@ public:
 	 * @see updateScreen
 	 * @see getScreenFormat
 	 */
-	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) = 0;
+	virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) = 0;
 
 	/**
 	 * Lock the active screen framebuffer and return a Graphics::Surface


Commit: d4a5615a8bc50c6f5f9221a71135d9b4f5726522
    https://github.com/scummvm/scummvm/commit/d4a5615a8bc50c6f5f9221a71135d9b4f5726522
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:38:56-07:00

Commit Message:
CGE: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/cge/vga13h.cpp



diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 186de24..3800b66 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -834,7 +834,7 @@ void Vga::update() {
 		}
 	}
 
-	g_system->copyRectToScreen((const byte *)Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight);
+	g_system->copyRectToScreen(Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight);
 	g_system->updateScreen();
 }
 


Commit: 2afc0a5fbc963562b5826965f4498156d1767a62
    https://github.com/scummvm/scummvm/commit/2afc0a5fbc963562b5826965f4498156d1767a62
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:38:59-07:00

Commit Message:
GROOVIE: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/groovie/graphics.cpp
    engines/groovie/roq.cpp
    engines/groovie/script.cpp



diff --git a/engines/groovie/graphics.cpp b/engines/groovie/graphics.cpp
index c3ca037..73eb574 100644
--- a/engines/groovie/graphics.cpp
+++ b/engines/groovie/graphics.cpp
@@ -94,7 +94,7 @@ void GraphicsMan::mergeFgAndBg() {
 }
 
 void GraphicsMan::updateScreen(Graphics::Surface *source) {
-	_vm->_system->copyRectToScreen((byte *)source->getBasePtr(0, 0), 640, 0, 80, 640, 320);
+	_vm->_system->copyRectToScreen(source->getBasePtr(0, 0), 640, 0, 80, 640, 320);
 	change();
 }
 
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index baf42a7..35d7ecf 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -160,7 +160,7 @@ bool ROQPlayer::playFrameInternal() {
 
 	if (_dirty) {
 		// Update the screen
-		_syst->copyRectToScreen((byte *)_bg->getBasePtr(0, 0), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h);
+		_syst->copyRectToScreen(_bg->getBasePtr(0, 0), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h);
 		_syst->updateScreen();
 
 		// Clear the dirty flag
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 6841523..cbbdecc 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -373,7 +373,7 @@ bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) {
 	    DebugMan.isDebugChannelEnabled(kGroovieDebugAll)) {
 		rect.translate(0, -80);
 		_vm->_graphicsMan->_foreground.frameRect(rect, 250);
-		_vm->_system->copyRectToScreen((byte *)_vm->_graphicsMan->_foreground.getBasePtr(0, 0), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320);
+		_vm->_system->copyRectToScreen(_vm->_graphicsMan->_foreground.getBasePtr(0, 0), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320);
 		_vm->_system->updateScreen();
 	}
 
@@ -1231,7 +1231,7 @@ void Script::o_copyrecttobg() {	// 0x37
 		memcpy(bg + offset, fg + offset, width);
 		offset += 640;
 	}
-	_vm->_system->copyRectToScreen((byte *)_vm->_graphicsMan->_background.getBasePtr(left, top - 80), 640, left, top, width, height);
+	_vm->_system->copyRectToScreen(_vm->_graphicsMan->_background.getBasePtr(left, top - 80), 640, left, top, width, height);
 	_vm->_graphicsMan->change();
 }
 


Commit: 2e97e043fb8610d1d85bbd3e5e2d7ad4990ef8a0
    https://github.com/scummvm/scummvm/commit/2e97e043fb8610d1d85bbd3e5e2d7ad4990ef8a0
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:38:59-07:00

Commit Message:
LASTEXPRESS: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/lastexpress/data/animation.cpp
    engines/lastexpress/graphics.cpp



diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp
index 28d30ec..9d0ed53 100644
--- a/engines/lastexpress/data/animation.cpp
+++ b/engines/lastexpress/data/animation.cpp
@@ -272,7 +272,7 @@ void Animation::play() {
 			draw(s);
 
 			// XXX: Update the screen
-			g_system->copyRectToScreen((byte *)s->pixels, s->pitch, 0, 0, s->w, s->h);
+			g_system->copyRectToScreen(s->pixels, s->pitch, 0, 0, s->w, s->h);
 
 			// Free the temporary surface
 			s->free();
diff --git a/engines/lastexpress/graphics.cpp b/engines/lastexpress/graphics.cpp
index e129457..753c3a3 100644
--- a/engines/lastexpress/graphics.cpp
+++ b/engines/lastexpress/graphics.cpp
@@ -160,7 +160,7 @@ void GraphicsManager::mergePlanes() {
 
 void GraphicsManager::updateScreen() {
 	g_system->fillScreen(0);
-	g_system->copyRectToScreen((byte *)_screen.getBasePtr(0, 0), 640 * 2, 0, 0, 640, 480);
+	g_system->copyRectToScreen(_screen.getBasePtr(0, 0), 640 * 2, 0, 0, 640, 480);
 }
 
 } // End of namespace LastExpress


Commit: 79dfc7be97c89fcc97332d2e05e22b683e05a7cb
    https://github.com/scummvm/scummvm/commit/79dfc7be97c89fcc97332d2e05e22b683e05a7cb
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:38:59-07:00

Commit Message:
MADE: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/made/pmvplayer.cpp
    engines/made/screen.cpp
    engines/made/screen.h
    engines/made/screenfx.cpp



diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp
index 6c4749f..cf450f7 100644
--- a/engines/made/pmvplayer.cpp
+++ b/engines/made/pmvplayer.cpp
@@ -248,7 +248,7 @@ void PmvPlayer::handleEvents() {
 }
 
 void PmvPlayer::updateScreen() {
-	_vm->_system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch,
+	_vm->_system->copyRectToScreen(_surface->pixels, _surface->pitch,
 									(320 - _surface->w) / 2, (200 - _surface->h) / 2, _surface->w, _surface->h);
 	_vm->_system->updateScreen();
 }
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index b49bfff..ea7d57f 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -349,7 +349,7 @@ void Screen::updateSprites() {
 	drawSpriteChannels(_backgroundScreenDrawCtx, 3, 0);
 	drawSpriteChannels(_workScreenDrawCtx, 1, 2);
 
-	_vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
+	_vm->_system->copyRectToScreen(_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
 	_vm->_screen->updateScreenAndWait(10);
 }
 
@@ -775,10 +775,10 @@ void Screen::unlockScreen() {
 }
 
 void Screen::showWorkScreen() {
-	_vm->_system->copyRectToScreen((const byte*)_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
+	_vm->_system->copyRectToScreen(_workScreen->pixels, _workScreen->pitch, 0, 0, _workScreen->w, _workScreen->h);
 }
 
-void Screen::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+void Screen::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
 	_vm->_system->copyRectToScreen(buf, pitch, x, y, w, h);
 }
 
diff --git a/engines/made/screen.h b/engines/made/screen.h
index a61ecab..266ac38 100644
--- a/engines/made/screen.h
+++ b/engines/made/screen.h
@@ -176,7 +176,7 @@ public:
 	Graphics::Surface *lockScreen();
 	void unlockScreen();
 	void showWorkScreen();
-	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);
 	void updateScreenAndWait(int delay);
 
 	int16 addToSpriteList(int16 index, int16 xofs, int16 yofs);
diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp
index 4e0d463..de9231a 100644
--- a/engines/made/screenfx.cpp
+++ b/engines/made/screenfx.cpp
@@ -293,7 +293,7 @@ void ScreenEffects::vfx00(Graphics::Surface *surface, byte *palette, byte *newPa
 void ScreenEffects::vfx01(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	startBlendedPalette(palette, newPalette, colorCount, 312);
 	for (int x = 0; x < 320; x += 8) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
+		_screen->copyRectToScreen(surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
 		stepBlendedPalette();
 		_screen->updateScreenAndWait(25);
 	}
@@ -303,7 +303,7 @@ void ScreenEffects::vfx01(Graphics::Surface *surface, byte *palette, byte *newPa
 void ScreenEffects::vfx02(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	startBlendedPalette(palette, newPalette, colorCount, 312);
 	for (int x = 312; x >= 0; x -= 8) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
+		_screen->copyRectToScreen(surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
 		stepBlendedPalette();
 		_screen->updateScreenAndWait(25);
 	}
@@ -313,7 +313,7 @@ void ScreenEffects::vfx02(Graphics::Surface *surface, byte *palette, byte *newPa
 void ScreenEffects::vfx03(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	startBlendedPalette(palette, newPalette, colorCount, 190);
 	for (int y = 0; y < 200; y += 10) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
+		_screen->copyRectToScreen(surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
 		stepBlendedPalette();
 		_screen->updateScreenAndWait(25);
 	}
@@ -323,7 +323,7 @@ void ScreenEffects::vfx03(Graphics::Surface *surface, byte *palette, byte *newPa
 void ScreenEffects::vfx04(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	startBlendedPalette(palette, newPalette, colorCount, 190);
 	for (int y = 190; y >= 0; y -= 10) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
+		_screen->copyRectToScreen(surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
 		stepBlendedPalette();
 		_screen->updateScreenAndWait(25);
 	}
@@ -333,8 +333,8 @@ void ScreenEffects::vfx04(Graphics::Surface *surface, byte *palette, byte *newPa
 void ScreenEffects::vfx05(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	startBlendedPalette(palette, newPalette, colorCount, 90);
 	for (int y = 0; y < 100; y += 10) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y + 100), surface->pitch, 0, y + 100, 320, 10);
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 90 - y), surface->pitch, 0, 90 - y, 320, 10);
+		_screen->copyRectToScreen(surface->getBasePtr(0, y + 100), surface->pitch, 0, y + 100, 320, 10);
+		_screen->copyRectToScreen(surface->getBasePtr(0, 90 - y), surface->pitch, 0, 90 - y, 320, 10);
 		stepBlendedPalette();
 		_screen->updateScreenAndWait(25);
 	}
@@ -345,8 +345,8 @@ void ScreenEffects::vfx05(Graphics::Surface *surface, byte *palette, byte *newPa
 void ScreenEffects::vfx06(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	startBlendedPalette(palette, newPalette, colorCount, 152);
 	for (int x = 0; x < 160; x += 8) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
+		_screen->copyRectToScreen(surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
+		_screen->copyRectToScreen(surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
 		stepBlendedPalette();
 		_screen->updateScreenAndWait(25);
 	}
@@ -357,8 +357,8 @@ void ScreenEffects::vfx06(Graphics::Surface *surface, byte *palette, byte *newPa
 void ScreenEffects::vfx07(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	startBlendedPalette(palette, newPalette, colorCount, 152);
 	for (int x = 152; x >= 0; x -= 8) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
+		_screen->copyRectToScreen(surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
+		_screen->copyRectToScreen(surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
 		stepBlendedPalette();
 		_screen->updateScreenAndWait(25);
 	}
@@ -368,7 +368,7 @@ void ScreenEffects::vfx07(Graphics::Surface *surface, byte *palette, byte *newPa
 // "Screen slide in" right to left
 void ScreenEffects::vfx08(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	for (int x = 8; x <= 320; x += 8) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 0), surface->pitch, 320 - x, 0, x, 200);
+		_screen->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, 320 - x, 0, x, 200);
 		_screen->updateScreenAndWait(25);
 	}
 	setPalette(palette);
@@ -509,7 +509,7 @@ void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPa
 // "Screen slide in" left to right
 void ScreenEffects::vfx18(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	for (int x = 8; x <= 320; x += 8) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(320 - x, 0), surface->pitch, 0, 0, x, 200);
+		_screen->copyRectToScreen(surface->getBasePtr(320 - x, 0), surface->pitch, 0, 0, x, 200);
 		_screen->updateScreenAndWait(25);
 	}
 
@@ -519,7 +519,7 @@ void ScreenEffects::vfx18(Graphics::Surface *surface, byte *palette, byte *newPa
 // "Screen slide in" top to bottom
 void ScreenEffects::vfx19(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	for (int y = 4; y <= 200; y += 4) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 200 - y), surface->pitch, 0, 0, 320, y);
+		_screen->copyRectToScreen(surface->getBasePtr(0, 200 - y), surface->pitch, 0, 0, 320, y);
 		_screen->updateScreenAndWait(25);
 	}
 
@@ -529,7 +529,7 @@ void ScreenEffects::vfx19(Graphics::Surface *surface, byte *palette, byte *newPa
 // "Screen slide in" bottom to top
 void ScreenEffects::vfx20(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
 	for (int y = 4; y <= 200; y += 4) {
-		_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 0), surface->pitch, 0, 200 - y, 320, y);
+		_screen->copyRectToScreen(surface->getBasePtr(0, 0), surface->pitch, 0, 200 - y, 320, y);
 		_screen->updateScreenAndWait(25);
 	}
 


Commit: d214391431300e3be72dcf4690e996b0558ec6f2
    https://github.com/scummvm/scummvm/commit/d214391431300e3be72dcf4690e996b0558ec6f2
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:38:59-07:00

Commit Message:
MOHAWK: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/mohawk/myst_graphics.cpp
    engines/mohawk/riven_graphics.cpp
    engines/mohawk/video.cpp



diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp
index 484e49d..ae80dd5 100644
--- a/engines/mohawk/myst_graphics.cpp
+++ b/engines/mohawk/myst_graphics.cpp
@@ -222,7 +222,7 @@ void MystGraphics::copyImageSectionToScreen(uint16 image, Common::Rect src, Comm
 
 	simulatePreviousDrawDelay(dest);
 
-	_vm->_system->copyRectToScreen((byte *)surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height);
+	_vm->_system->copyRectToScreen(surface->getBasePtr(src.left, top), surface->pitch, dest.left, dest.top, width, height);
 }
 
 void MystGraphics::copyImageSectionToBackBuffer(uint16 image, Common::Rect src, Common::Rect dest) {
@@ -280,7 +280,7 @@ void MystGraphics::copyBackBufferToScreen(Common::Rect r) {
 
 	simulatePreviousDrawDelay(r);
 
-	_vm->_system->copyRectToScreen((byte *)_backBuffer->getBasePtr(r.left, r.top), _backBuffer->pitch, r.left, r.top, r.width(), r.height());
+	_vm->_system->copyRectToScreen(_backBuffer->getBasePtr(r.left, r.top), _backBuffer->pitch, r.left, r.top, r.width(), r.height());
 }
 
 void MystGraphics::runTransition(uint16 type, Common::Rect rect, uint16 steps, uint16 delay) {
diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index 9415e51..05e66a3 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -115,7 +115,7 @@ void RivenGraphics::updateScreen(Common::Rect updateRect) {
 
 			// Copy to screen if there's no transition. Otherwise transition. ;)
 			if (_scheduledTransition < 0)
-				_vm->_system->copyRectToScreen((byte *)_mainScreen->getBasePtr(updateRect.left, updateRect.top), _mainScreen->pitch, updateRect.left, updateRect.top, updateRect.width(), updateRect.height());
+				_vm->_system->copyRectToScreen(_mainScreen->getBasePtr(updateRect.left, updateRect.top), _mainScreen->pitch, updateRect.left, updateRect.top, updateRect.width(), updateRect.height());
 			else
 				runScheduledTransition();
 
@@ -255,7 +255,7 @@ void RivenGraphics::runScheduledTransition() {
 	}
 
 	// For now, just copy the image to screen without doing any transition.
-	_vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
+	_vm->_system->copyRectToScreen(_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
 	_vm->_system->updateScreen();
 
 	_scheduledTransition = -1; // Clear scheduled transition
@@ -345,7 +345,7 @@ void RivenGraphics::drawInventoryImage(uint16 id, const Common::Rect *rect) {
 	mhkSurface->convertToTrueColor();
 	Graphics::Surface *surface = mhkSurface->getSurface();
 
-	_vm->_system->copyRectToScreen((byte *)surface->pixels, surface->pitch, rect->left, rect->top, surface->w, surface->h);
+	_vm->_system->copyRectToScreen(surface->pixels, surface->pitch, rect->left, rect->top, surface->w, surface->h);
 
 	delete mhkSurface;
 }
@@ -437,7 +437,7 @@ void RivenGraphics::updateCredits() {
 		}
 
 		// Now flush the new screen
-		_vm->_system->copyRectToScreen((byte *)_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
+		_vm->_system->copyRectToScreen(_mainScreen->pixels, _mainScreen->pitch, 0, 0, _mainScreen->w, _mainScreen->h);
 		_vm->_system->updateScreen();
 	}
 }
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index 15103b2..18d609c 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -245,7 +245,7 @@ bool VideoManager::updateMovies() {
 				// Clip the width/height to make sure we stay on the screen (Myst does this a few times)
 				uint16 width = MIN<int32>(_videoStreams[i]->getWidth(), _vm->_system->getWidth() - _videoStreams[i].x);
 				uint16 height = MIN<int32>(_videoStreams[i]->getHeight(), _vm->_system->getHeight() - _videoStreams[i].y);
-				_vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height);
+				_vm->_system->copyRectToScreen(frame->pixels, frame->pitch, _videoStreams[i].x, _videoStreams[i].y, width, height);
 
 				// We've drawn something to the screen, make sure we update it
 				updateScreen = true;


Commit: ebb5cb7e4c6266e99382792f6c3d65868f5bc5e9
    https://github.com/scummvm/scummvm/commit/ebb5cb7e4c6266e99382792f6c3d65868f5bc5e9
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:39:00-07:00

Commit Message:
SAGA: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/saga/introproc_ihnm.cpp
    engines/saga/introproc_saga2.cpp



diff --git a/engines/saga/introproc_ihnm.cpp b/engines/saga/introproc_ihnm.cpp
index 364c4cf..6015e67 100644
--- a/engines/saga/introproc_ihnm.cpp
+++ b/engines/saga/introproc_ihnm.cpp
@@ -212,7 +212,7 @@ bool Scene::playTitle(int title, int time, int mode) {
 			break;
 
 		case 2: // display background
-			_vm->_system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0,
+			_vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0,
 							  backBufferSurface->w, backBufferSurface->h);
 			phase++;
 			startTime = curTime;
@@ -247,7 +247,7 @@ bool Scene::playTitle(int title, int time, int mode) {
 
 					frameTime = curTime;
 
-					_vm->_system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0,
+					_vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0,
 							  backBufferSurface->w, backBufferSurface->h);
 				}
 
@@ -274,7 +274,7 @@ bool Scene::playTitle(int title, int time, int mode) {
 	_vm->_anim->endVideo();
 
 	memset((byte *)backBufferSurface->pixels, 0,  backBufferSurface->w *  backBufferSurface->h);
-	_vm->_system->copyRectToScreen((byte *)backBufferSurface->pixels, backBufferSurface->w, 0, 0,
+	_vm->_system->copyRectToScreen(backBufferSurface->pixels, backBufferSurface->w, 0, 0,
 							  backBufferSurface->w, backBufferSurface->h);
 
 	return interrupted;
diff --git a/engines/saga/introproc_saga2.cpp b/engines/saga/introproc_saga2.cpp
index bdf8936..b647037 100644
--- a/engines/saga/introproc_saga2.cpp
+++ b/engines/saga/introproc_saga2.cpp
@@ -105,7 +105,7 @@ void Scene::playMovie(const char *filename) {
 		if (smkDecoder->needsUpdate()) {
 			const Graphics::Surface *frame = smkDecoder->decodeNextFrame();
 			if (frame) {
-				_vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+				_vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h);
 
 				if (smkDecoder->hasDirtyPalette())
 					smkDecoder->setSystemPalette();


Commit: 084c1259fc5c185ec66001708f623d03675bf6f5
    https://github.com/scummvm/scummvm/commit/084c1259fc5c185ec66001708f623d03675bf6f5
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:39:00-07:00

Commit Message:
SCI: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/sci/engine/kvideo.cpp
    engines/sci/graphics/frameout.cpp
    engines/sci/graphics/maciconbar.cpp



diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index f176a13..fa9cc91 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -100,7 +100,7 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
 					g_sci->_gfxScreen->scale2x((byte *)frame->pixels, scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel);
 					g_system->copyRectToScreen(scaleBuffer, pitch, x, y, width, height);
 				} else {
-					g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, width, height);
+					g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, width, height);
 				}
 
 				if (videoDecoder->hasDirtyPalette())
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index dff3324..7a9c7ba 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -496,7 +496,7 @@ void GfxFrameout::showVideo() {
 		if (videoDecoder->needsUpdate()) {
 			const Graphics::Surface *frame = videoDecoder->decodeNextFrame();
 			if (frame) {
-				g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+				g_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h);
 
 				if (videoDecoder->hasDirtyPalette())
 					videoDecoder->setSystemPalette();
diff --git a/engines/sci/graphics/maciconbar.cpp b/engines/sci/graphics/maciconbar.cpp
index 7ecba5a..dfb50b0 100644
--- a/engines/sci/graphics/maciconbar.cpp
+++ b/engines/sci/graphics/maciconbar.cpp
@@ -129,7 +129,7 @@ void GfxMacIconBar::drawIcon(uint16 iconIndex, bool selected) {
 
 void GfxMacIconBar::drawEnabledImage(Graphics::Surface *surface, const Common::Rect &rect) {
 	if (surface)
-		g_system->copyRectToScreen((byte *)surface->pixels, surface->pitch, rect.left, rect.top, rect.width(), rect.height());
+		g_system->copyRectToScreen(surface->pixels, surface->pitch, rect.left, rect.top, rect.width(), rect.height());
 }
 
 void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common::Rect &rect) {
@@ -153,7 +153,7 @@ void GfxMacIconBar::drawDisabledImage(Graphics::Surface *surface, const Common::
 			*((byte *)newSurf.getBasePtr(j, i)) = 0;
 	}
 
-	g_system->copyRectToScreen((byte *)newSurf.pixels, newSurf.pitch, rect.left, rect.top, rect.width(), rect.height());
+	g_system->copyRectToScreen(newSurf.pixels, newSurf.pitch, rect.left, rect.top, rect.width(), rect.height());
 	newSurf.free();
 }
 


Commit: 64790aabc89ff128b7e3938d311a362619c4dd47
    https://github.com/scummvm/scummvm/commit/64790aabc89ff128b7e3938d311a362619c4dd47
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:39:00-07:00

Commit Message:
SCUMM: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/scumm/gfx.cpp



diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 2cf4a42..ffff329 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -755,7 +755,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
 					memset(blackbuf, 0, 16 * 240); // Prepare a buffer 16px wide and 240px high, to fit on a lateral strip
 
 					width = 240; // Fix right strip
-					_system->copyRectToScreen((const byte *)blackbuf, 16, 0, 0, 16, 240); // Fix left strip
+					_system->copyRectToScreen(blackbuf, 16, 0, 0, 16, 240); // Fix left strip
 				}
 			}
 
@@ -763,7 +763,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
 	}
 
 	// Finally blit the whole thing to the screen
-	_system->copyRectToScreen((const byte *)src, pitch, x, y, width, height);
+	_system->copyRectToScreen(src, pitch, x, y, width, height);
 }
 
 // CGA


Commit: d8aff72402a808082e1000851b0e11dbd5f57786
    https://github.com/scummvm/scummvm/commit/d8aff72402a808082e1000851b0e11dbd5f57786
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:39:00-07:00

Commit Message:
SWORD1: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/sword1/animation.cpp



diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index a70ca96..ddafd96 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -316,7 +316,7 @@ bool MoviePlayer::playVideo() {
 				if (_decoderType == kVideoDecoderPSX)
 					drawFramePSX(frame);
 				else
-					_vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+					_vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h);
 			}
 
 			if (_decoder->hasDirtyPalette()) {
@@ -501,7 +501,7 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) {
 	uint16 x = (g_system->getWidth() - scaledFrame.w) / 2;
 	uint16 y = (g_system->getHeight() - scaledFrame.h) / 2;
 
-	_vm->_system->copyRectToScreen((byte *)scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
+	_vm->_system->copyRectToScreen(scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
 
 	scaledFrame.free();
 }


Commit: 5f65cf9679b7c01052bb4e7fe46a74a10f84665c
    https://github.com/scummvm/scummvm/commit/5f65cf9679b7c01052bb4e7fe46a74a10f84665c
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:39:00-07:00

Commit Message:
SWORD25: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/sword25/fmv/movieplayer.cpp
    engines/sword25/gfx/graphicengine.cpp
    engines/sword25/gfx/image/renderedimage.cpp



diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp
index 4609565..9ee13b4 100644
--- a/engines/sword25/fmv/movieplayer.cpp
+++ b/engines/sword25/fmv/movieplayer.cpp
@@ -132,7 +132,7 @@ void MoviePlayer::update() {
 				const byte *frameData = (const byte *)s->getBasePtr(0, 0);
 				_outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch);
 #else
-				g_system->copyRectToScreen((byte *)s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h));
+				g_system->copyRectToScreen(s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h));
 				g_system->updateScreen();
 #endif
 			}
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 14ba032..6f5da32 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -216,7 +216,7 @@ bool GraphicEngine::fill(const Common::Rect *fillRectPtr, uint color) {
 			}
 		}
 
-		g_system->copyRectToScreen((byte *)_backSurface.getBasePtr(rect.left, rect.top), _backSurface.pitch, rect.left, rect.top, rect.width(), rect.height());
+		g_system->copyRectToScreen(_backSurface.getBasePtr(rect.left, rect.top), _backSurface.pitch, rect.left, rect.top, rect.width(), rect.height());
 	}
 
 	return true;
diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp
index b0d4853..27ee4ef 100644
--- a/engines/sword25/gfx/image/renderedimage.cpp
+++ b/engines/sword25/gfx/image/renderedimage.cpp
@@ -430,7 +430,7 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe
 			ino += inoStep;
 		}
 
-		g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(posX, posY), _backSurface->pitch, posX, posY,
+		g_system->copyRectToScreen(_backSurface->getBasePtr(posX, posY), _backSurface->pitch, posX, posY,
 			img->w, img->h);
 	}
 


Commit: 808e41d807cd909d18dadc612bc77d14bae2a18e
    https://github.com/scummvm/scummvm/commit/808e41d807cd909d18dadc612bc77d14bae2a18e
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:39:00-07:00

Commit Message:
SWORD2: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/sword2/animation.cpp



diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp
index 90ee737..5e3f892 100644
--- a/engines/sword2/animation.cpp
+++ b/engines/sword2/animation.cpp
@@ -332,7 +332,7 @@ bool MoviePlayer::playVideo() {
 				if (_decoderType == kVideoDecoderPSX)
 					drawFramePSX(frame);
 				else
-					_vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h);
+					_vm->_system->copyRectToScreen(frame->pixels, frame->pitch, x, y, frame->w, frame->h);
 			}
 
 			if (_decoder->hasDirtyPalette()) {
@@ -401,7 +401,7 @@ void MoviePlayer::drawFramePSX(const Graphics::Surface *frame) {
 	uint16 x = (g_system->getWidth() - scaledFrame.w) / 2;
 	uint16 y = (g_system->getHeight() - scaledFrame.h) / 2;
 
-	_vm->_system->copyRectToScreen((byte *)scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
+	_vm->_system->copyRectToScreen(scaledFrame.pixels, scaledFrame.pitch, x, y, scaledFrame.w, scaledFrame.h);
 
 	scaledFrame.free();
 }


Commit: f3c66a191f528004ea063025513dcd3a7d2d5d04
    https://github.com/scummvm/scummvm/commit/f3c66a191f528004ea063025513dcd3a7d2d5d04
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:39:00-07:00

Commit Message:
TEENAGENT: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/teenagent/scene.cpp
    engines/teenagent/teenagent.cpp



diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index e8c2dec..038c8ea 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -423,7 +423,7 @@ void Scene::init(int id, const Common::Point &pos) {
 	if (now_playing != res->dseg.get_byte(0xDB90))
 		_engine->music->load(res->dseg.get_byte(0xDB90));
 
-	_system->copyRectToScreen((const byte *)background.pixels, background.pitch, 0, 0, background.w, background.h);
+	_system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
 	setPalette(0);
 }
 
@@ -654,7 +654,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 delta) {
 		}
 
 		if (background.pixels && debug_features.feature[DebugFeatures::kShowBack]) {
-			_system->copyRectToScreen((const byte *)background.pixels, background.pitch, 0, 0, background.w, background.h);
+			_system->copyRectToScreen(background.pixels, background.pitch, 0, 0, background.w, background.h);
 		} else
 			_system->fillScreen(0);
 
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index fb228ef..f06de6f 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -389,7 +389,7 @@ bool TeenAgentEngine::showLogo() {
 				return true;
 			}
 
-			_system->copyRectToScreen((const byte *)s.pixels, s.w, s.x, s.y, s.w, s.h);
+			_system->copyRectToScreen(s.pixels, s.w, s.x, s.y, s.w, s.h);
 			_system->updateScreen();
 
 			_system->delayMillis(100);


Commit: 72f1fb0bed17106fa4d3b437699bc1bc9db62192
    https://github.com/scummvm/scummvm/commit/72f1fb0bed17106fa4d3b437699bc1bc9db62192
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:39:00-07:00

Commit Message:
TOLTECS: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/toltecs/menu.cpp
    engines/toltecs/render.cpp
    engines/toltecs/toltecs.cpp



diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp
index 172ec0a..415f19c 100644
--- a/engines/toltecs/menu.cpp
+++ b/engines/toltecs/menu.cpp
@@ -81,7 +81,7 @@ int MenuSystem::run() {
 	
 	// Restore original background
 	memcpy(_vm->_screen->_frontScreen, backgroundOrig.getBasePtr(0,0), 640 * 400);
-	_vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
+	_vm->_system->copyRectToScreen(_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
 	_vm->_system->updateScreen();
 
 	// Cleanup
@@ -103,8 +103,8 @@ void MenuSystem::update() {
 	handleEvents();
 
 	if (_needRedraw) {
-		//_vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen + 39 * 640 + 60, 640, 60, 39, 520, 247);
-		_vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
+		//_vm->_system->copyRectToScreen(_vm->_screen->_frontScreen + 39 * 640 + 60, 640, 60, 39, 520, 247);
+		_vm->_system->copyRectToScreen(_vm->_screen->_frontScreen, 640, 0, 0, 640, 400);
 		//debug("redraw");
 		_needRedraw = false;
 	}
diff --git a/engines/toltecs/render.cpp b/engines/toltecs/render.cpp
index de5e77f..3f53564 100644
--- a/engines/toltecs/render.cpp
+++ b/engines/toltecs/render.cpp
@@ -193,7 +193,7 @@ void RenderQueue::update() {
 
 	if (doFullRefresh) {
 		clear();
-		_vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen, 640, 0, 0, 640, _vm->_cameraHeight);
+		_vm->_system->copyRectToScreen(_vm->_screen->_frontScreen, 640, 0, 0, 640, _vm->_cameraHeight);
 	} else {
 		updateDirtyRects();
 	}
@@ -301,7 +301,7 @@ void RenderQueue::updateDirtyRects() {
 	int n_rects = 0;
 	Common::Rect *rects = _updateUta->getRectangles(&n_rects, 0, 0, 639, _vm->_cameraHeight - 1);
 	for (int i = 0; i < n_rects; i++) {
-		_vm->_system->copyRectToScreen((const byte *)_vm->_screen->_frontScreen + rects[i].left + rects[i].top * 640,
+		_vm->_system->copyRectToScreen(_vm->_screen->_frontScreen + rects[i].left + rects[i].top * 640,
 			640, rects[i].left, rects[i].top, rects[i].width(), rects[i].height());
 	}
 	delete[] rects;
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index d403e04..6d6c37d 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -300,7 +300,7 @@ void ToltecsEngine::drawScreen() {
 
 	if (_screen->_guiRefresh && _guiHeight > 0 && _cameraHeight > 0) {
 		// Update the GUI when needed and it's visible
-		_system->copyRectToScreen((const byte *)_screen->_frontScreen + _cameraHeight * 640,
+		_system->copyRectToScreen(_screen->_frontScreen + _cameraHeight * 640,
 			640, 0, _cameraHeight, 640, _guiHeight);
 		_screen->_guiRefresh = false;
 	}


Commit: 58bf8090cc760cd3c02724ae4479494d3b3a2cc1
    https://github.com/scummvm/scummvm/commit/58bf8090cc760cd3c02724ae4479494d3b3a2cc1
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T17:39:00-07:00

Commit Message:
TOON: Get rid of casts on OSystem::copyRectToScreen calls.

Changed paths:
    engines/toon/movie.cpp



diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp
index 59ad848..8cdf923 100644
--- a/engines/toon/movie.cpp
+++ b/engines/toon/movie.cpp
@@ -116,17 +116,17 @@ bool Movie::playVideo(bool isFirstIntroVideo) {
 					}
 					_vm->getSystem()->unlockScreen();
 				} else {
-					_vm->getSystem()->copyRectToScreen((byte *)frame->pixels, frame->pitch, 0, 0, frame->w, frame->h);
+					_vm->getSystem()->copyRectToScreen(frame->pixels, frame->pitch, 0, 0, frame->w, frame->h);
 
 					// WORKAROUND: There is an encoding glitch in the first intro video. This hides this using the adjacent pixels.
 					if (isFirstIntroVideo) {
 						int32 currentFrame = _decoder->getCurFrame();
 						if (currentFrame >= 956 && currentFrame <= 1038) {
 							debugC(1, kDebugMovie, "Triggered workaround for glitch in first intro video...");
-							_vm->getSystem()->copyRectToScreen((const byte *)frame->getBasePtr(frame->w-188, 123), frame->pitch, frame->w-188, 124, 188, 1);
-							_vm->getSystem()->copyRectToScreen((const byte *)frame->getBasePtr(frame->w-188, 126), frame->pitch, frame->w-188, 125, 188, 1);
-							_vm->getSystem()->copyRectToScreen((const byte *)frame->getBasePtr(0, 125), frame->pitch, 0, 126, 64, 1);
-							_vm->getSystem()->copyRectToScreen((const byte *)frame->getBasePtr(0, 128), frame->pitch, 0, 127, 64, 1);
+							_vm->getSystem()->copyRectToScreen(frame->getBasePtr(frame->w-188, 123), frame->pitch, frame->w-188, 124, 188, 1);
+							_vm->getSystem()->copyRectToScreen(frame->getBasePtr(frame->w-188, 126), frame->pitch, frame->w-188, 125, 188, 1);
+							_vm->getSystem()->copyRectToScreen(frame->getBasePtr(0, 125), frame->pitch, 0, 126, 64, 1);
+							_vm->getSystem()->copyRectToScreen(frame->getBasePtr(0, 128), frame->pitch, 0, 127, 64, 1);
 						}
 					}
 				}


Commit: d27d951d0b079a301ea1c6a3731bc1fc83234cff
    https://github.com/scummvm/scummvm/commit/d27d951d0b079a301ea1c6a3731bc1fc83234cff
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T18:28:42-07:00

Commit Message:
BACKENDS: Make OSystem::setMouseCursor take a "const void *" buffer.

This is mainly for consistency with OSystem::copyRectToScreen.

Changed paths:
    backends/graphics/graphics.h
    backends/graphics/null/null-graphics.h
    backends/graphics/opengl/opengl-graphics.cpp
    backends/graphics/opengl/opengl-graphics.h
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h
    backends/graphics/wincesdl/wincesdl-graphics.cpp
    backends/graphics/wincesdl/wincesdl-graphics.h
    backends/modular-backend.cpp
    backends/modular-backend.h
    backends/platform/android/android.h
    backends/platform/android/gfx.cpp
    backends/platform/dc/dc.h
    backends/platform/dc/display.cpp
    backends/platform/ds/arm9/source/osystem_ds.cpp
    backends/platform/ds/arm9/source/osystem_ds.h
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.mm
    backends/platform/n64/osys_n64.h
    backends/platform/n64/osys_n64_base.cpp
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h
    backends/platform/psp/osys_psp.cpp
    backends/platform/psp/osys_psp.h
    backends/platform/wii/osystem.h
    backends/platform/wii/osystem_gfx.cpp
    common/system.h



diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index 056e894..9fde5cf 100644
--- a/backends/graphics/graphics.h
+++ b/backends/graphics/graphics.h
@@ -80,7 +80,7 @@ public:
 
 	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) {}
diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h
index 6ffe2e8..30b1946 100644
--- a/backends/graphics/null/null-graphics.h
+++ b/backends/graphics/null/null-graphics.h
@@ -78,7 +78,7 @@ public:
 
 	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) {}
 };
 
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 033814a..ed63916 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -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;
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index 350ffa5..b2f7818 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -104,7 +104,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 = 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);
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 9244135..cdbe629 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -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();
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index f2b2d7b..f387c21 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -131,7 +131,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 = 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
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp
index 2315c58..13d52bc 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.cpp
+++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp
@@ -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)
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.h b/backends/graphics/wincesdl/wincesdl-graphics.h
index 26067f0..33bf7e7 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.h
+++ b/backends/graphics/wincesdl/wincesdl-graphics.h
@@ -73,7 +73,7 @@ public:
 	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();
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index 2b40876..3c26d5a 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -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);
 }
 
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index fd4aca2..4001024 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -100,7 +100,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 = 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);
 
 	//@}
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index bf66270..ce51bae 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 a40a9e2..1241667 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 95cb88c..aa2a370 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 264b866..35e7b70 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 f91342a..b4bf38c 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 789053e..d35b16c 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 da3864e..b15b5e0 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 387d91f..1649956 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 8e28dc9..121f84f 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 d895640..b526c68 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 9413c55..a639725 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 d167988..efbe7d5 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 46e11b1..3fe9a7f 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 af01b6f..d167c75 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 75c19e6..ecd6917 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 c2b6553..741acd4 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
diff --git a/common/system.h b/common/system.h
index f35c09c..a6753ea 100644
--- a/common/system.h
+++ b/common/system.h
@@ -874,7 +874,7 @@ public:
 	 *                          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.


Commit: e1e1f01b873f0d8ed09abcda37789deb09ba83c5
    https://github.com/scummvm/scummvm/commit/e1e1f01b873f0d8ed09abcda37789deb09ba83c5
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T18:28:42-07:00

Commit Message:
GRAPHICS: Let CursorMan's cursor functions take "const void *" buffers.

Changed paths:
    graphics/cursorman.cpp
    graphics/cursorman.h



diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 825b5c2..c818101 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -55,7 +55,7 @@ bool CursorManager::showMouse(bool visible) {
 	return g_system->showMouse(visible);
 }
 
-void CursorManager::pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
+void CursorManager::pushCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
 	Cursor *cur = new Cursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format);
 
 	cur->_visible = isVisible();
@@ -98,7 +98,7 @@ void CursorManager::popAllCursors() {
 	g_system->showMouse(isVisible());
 }
 
-void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
+void CursorManager::replaceCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
 
 	if (_cursorStack.empty()) {
 		pushCursor(buf, w, h, hotspotX, hotspotY, keycolor, dontScale, format);
@@ -225,7 +225,7 @@ void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint nu
 	}
 }
 
-CursorManager::Cursor::Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
+CursorManager::Cursor::Cursor(const void *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale, const Graphics::PixelFormat *format) {
 #ifdef USE_RGB_COLOR
 	if (!format)
 		_format = Graphics::PixelFormat::createFormatCLUT8();
diff --git a/graphics/cursorman.h b/graphics/cursorman.h
index 852109d..66e8d1b 100644
--- a/graphics/cursorman.h
+++ b/graphics/cursorman.h
@@ -71,7 +71,7 @@ public:
 	 *       useful to push a "dummy" cursor and modify it later. The
 	 *       cursor will be added to the stack, but not to the backend.
 	 */
-	void pushCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
+	void pushCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
 
 	/**
 	 * Pop a cursor from the stack, and restore the previous one to the
@@ -96,7 +96,7 @@ public:
 	 * @param format	a pointer to the pixel format which the cursor graphic uses,
 	 *					CLUT8 will be used if this is NULL or not specified.
 	 */
-	void replaceCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
+	void replaceCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
 
 	/**
 	 * Pop all of the cursors and cursor palettes from their respective stacks.
@@ -181,7 +181,7 @@ private:
 
 		uint _size;
 
-		Cursor(const byte *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
+		Cursor(const void *data, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = NULL);
 		~Cursor();
 	};
 


Commit: 0268f21980491b3fc0c50dab371193d69aae43e4
    https://github.com/scummvm/scummvm/commit/0268f21980491b3fc0c50dab371193d69aae43e4
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T18:28:42-07:00

Commit Message:
DRASCULA: Get rid of casts on CursorManager::replaceCursor calls.

Changed paths:
    engines/drascula/interface.cpp



diff --git a/engines/drascula/interface.cpp b/engines/drascula/interface.cpp
index c08bcea..4b8db63 100644
--- a/engines/drascula/interface.cpp
+++ b/engines/drascula/interface.cpp
@@ -28,10 +28,10 @@ namespace Drascula {
 void DrasculaEngine::setCursor(int cursor) {
 	switch (cursor) {
 	case kCursorCrosshair:
-		CursorMan.replaceCursor((const byte *)crosshairCursor, 40, 25, 20, 17, 255);
+		CursorMan.replaceCursor(crosshairCursor, 40, 25, 20, 17, 255);
 		break;
 	case kCursorCurrentItem:
-		CursorMan.replaceCursor((const byte *)mouseCursor, OBJWIDTH, OBJHEIGHT, 20, 17, 255);
+		CursorMan.replaceCursor(mouseCursor, OBJWIDTH, OBJHEIGHT, 20, 17, 255);
 	default:
 		break;
 	}


Commit: 1cda4f903b320a1dff9577641b7171e2abaa82c7
    https://github.com/scummvm/scummvm/commit/1cda4f903b320a1dff9577641b7171e2abaa82c7
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T18:28:43-07:00

Commit Message:
LASTEXPRESS: Get rid of casts on CursorManager::replaceCursor calls.

Changed paths:
    engines/lastexpress/data/cursor.cpp



diff --git a/engines/lastexpress/data/cursor.cpp b/engines/lastexpress/data/cursor.cpp
index a3e7b77..205c46f 100644
--- a/engines/lastexpress/data/cursor.cpp
+++ b/engines/lastexpress/data/cursor.cpp
@@ -91,7 +91,7 @@ void Cursor::setStyle(CursorStyle style) {
 
 	// Reuse the screen pixel format
 	Graphics::PixelFormat pf = g_system->getScreenFormat();
-	CursorMan.replaceCursor((const byte *)getCursorImage(style),
+	CursorMan.replaceCursor(getCursorImage(style),
 	                        32, 32, _cursors[style].hotspotX, _cursors[style].hotspotY,
 	                        0, false, &pf);
 }


Commit: 57e0381b62790b894bb0f10f01531c629147d645
    https://github.com/scummvm/scummvm/commit/57e0381b62790b894bb0f10f01531c629147d645
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T18:28:43-07:00

Commit Message:
MADE: Get rid of casts on CursorManager::replaceCursor calls.

Changed paths:
    engines/made/scriptfuncs.cpp



diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index de7b5b7..c57778f 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -574,7 +574,7 @@ int16 ScriptFunctions::sfLoadMouseCursor(int16 argc, int16 *argv) {
 	PictureResource *flex = _vm->_res->getPicture(argv[2]);
 	if (flex) {
 		Graphics::Surface *surf = flex->getPicture();
-		CursorMan.replaceCursor((const byte *)surf->pixels, surf->w, surf->h, argv[1], argv[0], 0);
+		CursorMan.replaceCursor(surf->pixels, surf->w, surf->h, argv[1], argv[0], 0);
 		_vm->_res->freeResource(flex);
 	}
 	return 0;


Commit: 60a6ce70c1e792f14169641a50a9a43c8b65eb10
    https://github.com/scummvm/scummvm/commit/60a6ce70c1e792f14169641a50a9a43c8b65eb10
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T18:28:43-07:00

Commit Message:
MOHAWK: Get rid of casts on CursorManager::replaceCursor calls.

Changed paths:
    engines/mohawk/cursors.cpp



diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp
index 47a7d02..e73d4ed 100644
--- a/engines/mohawk/cursors.cpp
+++ b/engines/mohawk/cursors.cpp
@@ -121,11 +121,11 @@ void MystCursorManager::setCursor(uint16 id) {
 
 	// Myst ME stores some cursors as 24bpp images instead of 8bpp
 	if (surface->format.bytesPerPixel == 1) {
-		CursorMan.replaceCursor((byte *)surface->pixels, surface->w, surface->h, hotspotX, hotspotY, 0);
+		CursorMan.replaceCursor(surface->pixels, surface->w, surface->h, hotspotX, hotspotY, 0);
 		CursorMan.replaceCursorPalette(mhkSurface->getPalette(), 0, 256);
 	} else {
 		Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
-		CursorMan.replaceCursor((byte *)surface->pixels, surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat);
+		CursorMan.replaceCursor(surface->pixels, surface->w, surface->h, hotspotX, hotspotY, pixelFormat.RGBToColor(255, 255, 255), false, &pixelFormat);
 	}
 
 	_vm->_needsUpdate = true;


Commit: 7b646e5c62c37b5a593994d1e27a79c62fecd501
    https://github.com/scummvm/scummvm/commit/7b646e5c62c37b5a593994d1e27a79c62fecd501
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T18:28:43-07:00

Commit Message:
SCI: Get rid of casts on CursorManager::replaceCursor calls.

Changed paths:
    engines/sci/graphics/cursor.cpp



diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index 14ffa69..ce77cf6 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -411,7 +411,7 @@ void GfxCursor::refreshPosition() {
 			}
 		}
 
-		CursorMan.replaceCursor((const byte *)_cursorSurface, cursorCelInfo->width, cursorCelInfo->height, cursorHotspot.x, cursorHotspot.y, cursorCelInfo->clearKey);
+		CursorMan.replaceCursor(_cursorSurface, cursorCelInfo->width, cursorCelInfo->height, cursorHotspot.x, cursorHotspot.y, cursorCelInfo->clearKey);
 	}
 }
 


Commit: 99229fc7ab3a15da8b964443cb58bc00caa5f0a4
    https://github.com/scummvm/scummvm/commit/99229fc7ab3a15da8b964443cb58bc00caa5f0a4
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T18:28:43-07:00

Commit Message:
TOLTECS: Get rid of casts on CursorManager::replaceCursor calls.

Changed paths:
    engines/toltecs/screen.cpp



diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
index b781490..634917a 100644
--- a/engines/toltecs/screen.cpp
+++ b/engines/toltecs/screen.cpp
@@ -114,7 +114,7 @@ void Screen::loadMouseCursor(uint resIndex) {
 		}
 	}
 	// FIXME: Where's the cursor hotspot? Using 8, 8 seems good enough for now.
-	CursorMan.replaceCursor((const byte*)mouseCursor, 16, 16, 8, 8, 0);
+	CursorMan.replaceCursor(mouseCursor, 16, 16, 8, 8, 0);
 }
 
 void Screen::drawGuiImage(int16 x, int16 y, uint resIndex) {


Commit: aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95
    https://github.com/scummvm/scummvm/commit/aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-15T19:17:14-07:00

Commit Message:
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.

Changed paths:
    backends/graphics/graphics.h
    backends/graphics/null/null-graphics.h
    backends/graphics/opengl/opengl-graphics.cpp
    backends/graphics/opengl/opengl-graphics.h
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h
    backends/graphics/wincesdl/wincesdl-graphics.cpp
    backends/graphics/wincesdl/wincesdl-graphics.h
    backends/modular-backend.cpp
    backends/modular-backend.h
    backends/platform/android/android.h
    backends/platform/android/gfx.cpp
    backends/platform/dc/dc.h
    backends/platform/dc/display.cpp
    backends/platform/ds/arm9/source/osystem_ds.cpp
    backends/platform/ds/arm9/source/osystem_ds.h
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.mm
    backends/platform/n64/osys_n64.h
    backends/platform/n64/osys_n64_base.cpp
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/Gs2dScreen.h
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h
    backends/platform/psp/default_display_client.cpp
    backends/platform/psp/default_display_client.h
    backends/platform/psp/osys_psp.cpp
    backends/platform/psp/osys_psp.h
    backends/platform/wii/osystem.h
    backends/platform/wii/osystem_gfx.cpp
    backends/vkeybd/virtual-keyboard-gui.cpp
    common/system.h
    engines/testbed/graphics.cpp
    graphics/VectorRendererSpec.cpp
    gui/ThemeEngine.cpp



diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index 9fde5cf..2439722 100644
--- a/backends/graphics/graphics.h
+++ b/backends/graphics/graphics.h
@@ -73,8 +73,8 @@ public:
 	virtual void hideOverlay() = 0;
 	virtual Graphics::PixelFormat getOverlayFormat() const = 0;
 	virtual void clearOverlay() = 0;
-	virtual void grabOverlay(OverlayColor *buf, int pitch) = 0;
-	virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h)= 0;
+	virtual void grabOverlay(void *buf, int pitch) = 0;
+	virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h)= 0;
 	virtual int16 getOverlayHeight() = 0;
 	virtual int16 getOverlayWidth() = 0;
 
diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h
index 30b1946..276be7d 100644
--- a/backends/graphics/null/null-graphics.h
+++ b/backends/graphics/null/null-graphics.h
@@ -71,8 +71,8 @@ public:
 	void hideOverlay() {}
 	Graphics::PixelFormat getOverlayFormat() const { return Graphics::PixelFormat(); }
 	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() { return 0; }
 	int16 getOverlayWidth() { return 0; }
 
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index ed63916..dce902d 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -467,33 +467,35 @@ void OpenGLGraphicsManager::clearOverlay() {
 	_overlayNeedsRedraw = true;
 }
 
-void OpenGLGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
-	assert(_overlayData.format.bytesPerPixel == sizeof(buf[0]));
+void OpenGLGraphicsManager::grabOverlay(void *buf, int pitch) {
 	const byte *src = (byte *)_overlayData.pixels;
+	byte *dst = (byte *)buf;
 	for (int i = 0; i < _overlayData.h; i++) {
 		// Copy overlay data to buffer
-		memcpy(buf, src, _overlayData.pitch);
-		buf += pitch;
+		memcpy(dst, src, _overlayData.pitch);
+		dst += pitch;
 		src += _overlayData.pitch;
 	}
 }
 
-void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void OpenGLGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
 	assert(_transactionMode == kTransactionNone);
 
 	if (_overlayTexture == NULL)
 		return;
 
+	const byte *src = (const byte *)buf;
+
 	// Clip the coordinates
 	if (x < 0) {
 		w += x;
-		buf -= x;
+		src -= x * 2;
 		x = 0;
 	}
 
 	if (y < 0) {
 		h += y;
-		buf -= y * pitch;
+		src -= y * pitch;
 		y = 0;
 	}
 
@@ -507,11 +509,10 @@ void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch
 		return;
 
 	// Copy buffer data to internal overlay surface
-	const byte *src = (const byte *)buf;
 	byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch;
 	for (int i = 0; i < h; i++) {
 		memcpy(dst + x * _overlayData.format.bytesPerPixel, src, w * _overlayData.format.bytesPerPixel);
-		src += pitch * sizeof(buf[0]);
+		src += pitch;
 		dst += _overlayData.pitch;
 	}
 
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index b2f7818..9d8d418 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -97,8 +97,8 @@ public:
 	virtual void hideOverlay();
 	virtual Graphics::PixelFormat getOverlayFormat() const;
 	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();
 
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index cdbe629..fb964d6 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -1597,7 +1597,7 @@ void SurfaceSdlGraphicsManager::clearOverlay() {
 	_forceFull = true;
 }
 
-void SurfaceSdlGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
+void SurfaceSdlGraphicsManager::grabOverlay(void *buf, int pitch) {
 	assert(_transactionMode == kTransactionNone);
 
 	if (_overlayscreen == NULL)
@@ -1607,31 +1607,35 @@ void SurfaceSdlGraphicsManager::grabOverlay(OverlayColor *buf, int pitch) {
 		error("SDL_LockSurface failed: %s", SDL_GetError());
 
 	byte *src = (byte *)_overlayscreen->pixels;
+	byte *dst = (byte *)buf;
 	int h = _videoMode.overlayHeight;
 	do {
-		memcpy(buf, src, _videoMode.overlayWidth * 2);
+		memcpy(dst, src, _videoMode.overlayWidth * 2);
 		src += _overlayscreen->pitch;
-		buf += pitch;
+		dst += pitch;
 	} while (--h);
 
 	SDL_UnlockSurface(_overlayscreen);
 }
 
-void SurfaceSdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void SurfaceSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
 	assert(_transactionMode == kTransactionNone);
 
 	if (_overlayscreen == NULL)
 		return;
 
+	const byte *src = (const byte *)buf;
+
 	// Clip the coordinates
 	if (x < 0) {
 		w += x;
-		buf -= x;
+		src -= x * 2;
 		x = 0;
 	}
 
 	if (y < 0) {
-		h += y; buf -= y * pitch;
+		h += y;
+		src -= y * pitch;
 		y = 0;
 	}
 
@@ -1654,9 +1658,9 @@ void SurfaceSdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int p
 
 	byte *dst = (byte *)_overlayscreen->pixels + y * _overlayscreen->pitch + x * 2;
 	do {
-		memcpy(dst, buf, w * 2);
+		memcpy(dst, src, w * 2);
 		dst += _overlayscreen->pitch;
-		buf += pitch;
+		src += pitch;
 	} while (--h);
 
 	SDL_UnlockSurface(_overlayscreen);
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index f387c21..21444cc 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -124,8 +124,8 @@ public:
 	virtual void hideOverlay();
 	virtual Graphics::PixelFormat getOverlayFormat() const { return _overlayFormat; }
 	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() { return _videoMode.overlayHeight; }
 	virtual int16 getOverlayWidth() { return _videoMode.overlayWidth; }
 
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.cpp b/backends/graphics/wincesdl/wincesdl-graphics.cpp
index 13d52bc..f075f8c 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.cpp
+++ b/backends/graphics/wincesdl/wincesdl-graphics.cpp
@@ -1023,22 +1023,24 @@ bool WINCESdlGraphicsManager::saveScreenshot(const char *filename) {
 	return true;
 }
 
-void WINCESdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void WINCESdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
 	assert(_transactionMode == kTransactionNone);
 
 	if (_overlayscreen == NULL)
 		return;
 
+	const byte *src = (const byte *)buf;
+
 	// Clip the coordinates
 	if (x < 0) {
 		w += x;
-		buf -= x;
+		src -= x * 2;
 		x = 0;
 	}
 
 	if (y < 0) {
 		h += y;
-		buf -= y * pitch;
+		src -= y * pitch;
 		y = 0;
 	}
 
@@ -1063,9 +1065,9 @@ void WINCESdlGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pit
 
 	byte *dst = (byte *)_overlayscreen->pixels + y * _overlayscreen->pitch + x * 2;
 	do {
-		memcpy(dst, buf, w * 2);
+		memcpy(dst, src, w * 2);
 		dst += _overlayscreen->pitch;
-		buf += pitch;
+		src += pitch;
 	} while (--h);
 
 	SDL_UnlockSurface(_overlayscreen);
diff --git a/backends/graphics/wincesdl/wincesdl-graphics.h b/backends/graphics/wincesdl/wincesdl-graphics.h
index 33bf7e7..2897ca5 100644
--- a/backends/graphics/wincesdl/wincesdl-graphics.h
+++ b/backends/graphics/wincesdl/wincesdl-graphics.h
@@ -74,7 +74,7 @@ public:
 	void undrawMouse();
 	bool showMouse(bool visible);
 	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 copyRectToOverlay(const void *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();
 	void unlockScreen();
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index 3c26d5a..b46f33a 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -171,11 +171,11 @@ void ModularBackend::clearOverlay() {
 	_graphicsManager->clearOverlay();
 }
 
-void ModularBackend::grabOverlay(OverlayColor *buf, int pitch) {
+void ModularBackend::grabOverlay(void *buf, int pitch) {
 	_graphicsManager->grabOverlay(buf, pitch);
 }
 
-void ModularBackend::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+void ModularBackend::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
 	_graphicsManager->copyRectToOverlay(buf, pitch, x, y, w, h);
 }
 
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index 4001024..b43769c 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -93,8 +93,8 @@ public:
 	virtual void hideOverlay();
 	virtual Graphics::PixelFormat getOverlayFormat() const;
 	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();
 
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index ce51bae..4b13ca4 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 1241667..44046cb 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 aa2a370..d41839d 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 35e7b70..cc5798f 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 b4bf38c..5c20deb 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 d35b16c..a6001da 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 b15b5e0..0371254 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 1649956..b01c925 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 121f84f..3266180 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 b526c68..ed2badb 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 8df6198..f93166e 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 4fbb3fd..005dabc 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 a639725..5628658 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 efbe7d5..99482d4 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 2ee7ff5..bc25214 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 721a7e6..95c52e2 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 3fe9a7f..0032fea 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 d167c75..2afdabd 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 ecd6917..f1c8d77 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 741acd4..6b0e31b 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);
 	}
diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp
index 42f9707..75de864 100644
--- a/backends/vkeybd/virtual-keyboard-gui.cpp
+++ b/backends/vkeybd/virtual-keyboard-gui.cpp
@@ -161,7 +161,7 @@ void VirtualKeyboardGUI::run() {
 		_system->clearOverlay();
 	}
 	_overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat());
-	_system->grabOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w);
+	_system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch);
 
 	setupCursor();
 
@@ -171,7 +171,7 @@ void VirtualKeyboardGUI::run() {
 
 	removeCursor();
 
-	_system->copyRectToOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w, 0, 0, _overlayBackup.w, _overlayBackup.h);
+	_system->copyRectToOverlay(_overlayBackup.pixels, _overlayBackup.pitch, 0, 0, _overlayBackup.w, _overlayBackup.h);
 	if (!g_gui.isActive()) _system->hideOverlay();
 
 	_overlayBackup.free();
@@ -262,7 +262,7 @@ void VirtualKeyboardGUI::screenChanged() {
 		_screenH = newScreenH;
 
 		_overlayBackup.create(_screenW, _screenH, _system->getOverlayFormat());
-		_system->grabOverlay((OverlayColor *)_overlayBackup.pixels, _overlayBackup.w);
+		_system->grabOverlay(_overlayBackup.pixels, _overlayBackup.pitch);
 
 		if (!_kbd->checkModeResolutions()) {
 			_displaying = false;
@@ -371,7 +371,7 @@ void VirtualKeyboardGUI::redraw() {
 		blit(&surf, &_dispSurface, _dispX - _dirtyRect.left,
 		     _dispY - _dirtyRect.top, _dispBackColor);
 	}
-	_system->copyRectToOverlay((OverlayColor *)surf.pixels, surf.w,
+	_system->copyRectToOverlay(surf.pixels, surf.pitch,
 	                           _dirtyRect.left, _dirtyRect.top, surf.w, surf.h);
 
 	surf.free();
diff --git a/common/system.h b/common/system.h
index a6753ea..7a4fa00 100644
--- a/common/system.h
+++ b/common/system.h
@@ -790,20 +790,14 @@ public:
 	 * Copy the content of the overlay into a buffer provided by the caller.
 	 * This is only used to implement fake alpha blending.
 	 */
-	virtual void grabOverlay(OverlayColor *buf, int pitch) = 0;
+	virtual void grabOverlay(void *buf, int pitch) = 0;
 
 	/**
 	 * Blit a graphics buffer to the overlay.
 	 * In a sense, this is the reverse of grabOverlay.
 	 *
-	 * @note The pitch parameter actually contains the 'pixel pitch', i.e.,
-	 * the number of pixels per scanline, and not as usual the number of bytes
-	 * per scanline.
-	 *
-	 * @todo Change 'pitch' to be byte and not pixel based
-	 *
 	 * @param buf		the buffer containing the graphics data source
-	 * @param pitch		the pixel pitch of the buffer (number of pixels in a scanline)
+	 * @param pitch		the pitch of the buffer (number of bytes in a scanline)
 	 * @param x			the x coordinate of the destination rectangle
 	 * @param y			the y coordinate of the destination rectangle
 	 * @param w			the width of the destination rectangle
@@ -812,7 +806,7 @@ public:
 	 * @see copyRectToScreen
 	 * @see grabOverlay
 	 */
-	virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) = 0;
+	virtual void copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) = 0;
 
 	/**
 	 * Return the height of the overlay.
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 36ec726..082694b 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -935,7 +935,7 @@ TestExitStatus GFXtests::overlayGraphics() {
 	}
 
 	g_system->showOverlay();
-	g_system->copyRectToOverlay(buffer, 100, 270, 175, 100, 50);
+	g_system->copyRectToOverlay(buffer, 200, 270, 175, 100, 50);
 	g_system->updateScreen();
 
 	g_system->delayMillis(1000);
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 7817725..1ed5a33 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -422,8 +422,8 @@ void VectorRendererSpec<PixelType>::
 copyFrame(OSystem *sys, const Common::Rect &r) {
 
 	sys->copyRectToOverlay(
-		(const OverlayColor *)_activeSurface->getBasePtr(r.left, r.top),
-		_activeSurface->pitch / _activeSurface->format.bytesPerPixel,
+		_activeSurface->getBasePtr(r.left, r.top),
+		_activeSurface->pitch,
 	    r.left, r.top, r.width(), r.height()
 	);
 }
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 1bf7ad3..e37022f 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -429,7 +429,7 @@ bool ThemeEngine::init() {
 void ThemeEngine::clearAll() {
 	if (_initOk) {
 		_system->clearOverlay();
-		_system->grabOverlay((OverlayColor *)_screen.pixels, _screen.w);
+		_system->grabOverlay(_screen.pixels, _screen.pitch);
 	}
 }
 


Commit: 4fb9bceabc4309a477472aa55207eae55bc0aa13
    https://github.com/scummvm/scummvm/commit/4fb9bceabc4309a477472aa55207eae55bc0aa13
Author: Johannes Schickel (lordhoto at gmail.com)
Date: 2012-06-20T08:02:26-07:00

Commit Message:
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

Changed paths:
    backends/graphics/graphics.h
    backends/graphics/null/null-graphics.h
    backends/graphics/opengl/opengl-graphics.cpp
    backends/graphics/opengl/opengl-graphics.h
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h
    backends/graphics/wincesdl/wincesdl-graphics.cpp
    backends/graphics/wincesdl/wincesdl-graphics.h
    backends/modular-backend.cpp
    backends/modular-backend.h
    backends/platform/android/android.h
    backends/platform/android/gfx.cpp
    backends/platform/dc/dc.h
    backends/platform/dc/display.cpp
    backends/platform/ds/arm9/source/osystem_ds.cpp
    backends/platform/ds/arm9/source/osystem_ds.h
    backends/platform/iphone/osys_main.h
    backends/platform/iphone/osys_video.mm
    backends/platform/n64/osys_n64.h
    backends/platform/n64/osys_n64_base.cpp
    backends/platform/ps2/Gs2dScreen.cpp
    backends/platform/ps2/Gs2dScreen.h
    backends/platform/ps2/systemps2.cpp
    backends/platform/ps2/systemps2.h
    backends/platform/psp/default_display_client.cpp
    backends/platform/psp/default_display_client.h
    backends/platform/psp/osys_psp.cpp
    backends/platform/psp/osys_psp.h
    backends/platform/wii/osystem.h
    backends/platform/wii/osystem_gfx.cpp
    backends/vkeybd/virtual-keyboard-gui.cpp
    common/system.h
    engines/cge/vga13h.cpp
    engines/drascula/interface.cpp
    engines/groovie/graphics.cpp
    engines/groovie/roq.cpp
    engines/groovie/script.cpp
    engines/lastexpress/data/animation.cpp
    engines/lastexpress/data/cursor.cpp
    engines/lastexpress/graphics.cpp
    engines/made/pmvplayer.cpp
    engines/made/screen.cpp
    engines/made/screen.h
    engines/made/screenfx.cpp
    engines/made/scriptfuncs.cpp
    engines/mohawk/cursors.cpp
    engines/mohawk/myst_graphics.cpp
    engines/mohawk/riven_graphics.cpp
    engines/mohawk/video.cpp
    engines/saga/introproc_ihnm.cpp
    engines/saga/introproc_saga2.cpp
    engines/sci/engine/kvideo.cpp
    engines/sci/graphics/cursor.cpp
    engines/sci/graphics/frameout.cpp
    engines/sci/graphics/maciconbar.cpp
    engines/scumm/gfx.cpp
    engines/sword1/animation.cpp
    engines/sword2/animation.cpp
    engines/sword25/fmv/movieplayer.cpp
    engines/sword25/gfx/graphicengine.cpp
    engines/sword25/gfx/image/renderedimage.cpp
    engines/teenagent/scene.cpp
    engines/teenagent/teenagent.cpp
    engines/testbed/graphics.cpp
    engines/toltecs/menu.cpp
    engines/toltecs/render.cpp
    engines/toltecs/screen.cpp
    engines/toltecs/toltecs.cpp
    engines/toon/movie.cpp
    graphics/VectorRendererSpec.cpp
    graphics/cursorman.cpp
    graphics/cursorman.h
    gui/ThemeEngine.cpp









More information about the Scummvm-git-logs mailing list