From 31880186e1c78023e2e552a7fceaa27c3d2d08b1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 16 Jun 2012 02:18:01 +0200 Subject: BACKENDS: Let copyRectToScreen take a "const void *" instead of "const byte *" as buffer. This removes the need to convert the parameter to copyRectToScreen to "const byte *", which is commonly used in games, which use Graphics::Surface to store their graphics data. --- backends/platform/iphone/osys_main.h | 2 +- backends/platform/iphone/osys_video.mm | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'backends/platform/iphone') diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h index e06c7973ab..da3864e0df 100644 --- a/backends/platform/iphone/osys_main.h +++ b/backends/platform/iphone/osys_main.h @@ -143,7 +143,7 @@ protected: virtual void grabPalette(byte *colors, uint start, uint num); public: - virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h); + virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h); virtual void updateScreen(); virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm index ddfa8f5030..387d91ff57 100644 --- a/backends/platform/iphone/osys_video.mm +++ b/backends/platform/iphone/osys_video.mm @@ -161,18 +161,19 @@ void OSystem_IPHONE::grabPalette(byte *colors, uint start, uint num) { } } -void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { +void OSystem_IPHONE::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) { //printf("copyRectToScreen(%p, %d, %i, %i, %i, %i)\n", buf, pitch, x, y, w, h); //Clip the coordinates + const byte *src = (const byte *)buf; if (x < 0) { w += x; - buf -= x; + src -= x; x = 0; } if (y < 0) { h += y; - buf -= y * pitch; + src -= y * pitch; y = 0; } @@ -193,11 +194,11 @@ void OSystem_IPHONE::copyRectToScreen(const byte *buf, int pitch, int x, int y, byte *dst = (byte *)_framebuffer.getBasePtr(x, y); if (_framebuffer.pitch == pitch && _framebuffer.w == w) { - memcpy(dst, buf, h * pitch); + memcpy(dst, src, h * pitch); } else { do { - memcpy(dst, buf, w * _framebuffer.format.bytesPerPixel); - buf += pitch; + memcpy(dst, src, w * _framebuffer.format.bytesPerPixel); + src += pitch; dst += _framebuffer.pitch; } while (--h); } -- cgit v1.2.3