aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/iphone
diff options
context:
space:
mode:
authorJohannes Schickel2012-06-16 04:17:14 +0200
committerJohannes Schickel2012-06-16 04:17:14 +0200
commitaec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95 (patch)
tree94d1ddb5cf823bb08d86161f9e5415c54011a0ea /backends/platform/iphone
parent99229fc7ab3a15da8b964443cb58bc00caa5f0a4 (diff)
downloadscummvm-rg350-aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95.tar.gz
scummvm-rg350-aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95.tar.bz2
scummvm-rg350-aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95.zip
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.
Diffstat (limited to 'backends/platform/iphone')
-rw-r--r--backends/platform/iphone/osys_main.h4
-rw-r--r--backends/platform/iphone/osys_video.mm18
2 files changed, 12 insertions, 10 deletions
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index b15b5e0375..037125490d 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 1649956a6c..b01c925024 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);
}