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/ds/arm9/source/osystem_ds.cpp | 2 +- backends/platform/ds/arm9/source/osystem_ds.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'backends/platform/ds/arm9') diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index a6b85f207f..f91342a6ce 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 11b0988666..789053e522 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); -- cgit v1.2.3 From d27d951d0b079a301ea1c6a3731bc1fc83234cff Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 16 Jun 2012 03:10:43 +0200 Subject: BACKENDS: Make OSystem::setMouseCursor take a "const void *" buffer. This is mainly for consistency with OSystem::copyRectToScreen. --- backends/platform/ds/arm9/source/osystem_ds.cpp | 2 +- backends/platform/ds/arm9/source/osystem_ds.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'backends/platform/ds/arm9') diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index f91342a6ce..b4bf38c45b 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 789053e522..d35b16c8fd 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(); -- cgit v1.2.3 From aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 16 Jun 2012 04:17:14 +0200 Subject: ALL: Let overlay related methods in OSystem take a void * and use a proper pitch values. This is a first step to get rid of OverlayColor, which is a requirement for proper 4Bpp overlay support. --- backends/platform/ds/arm9/source/osystem_ds.cpp | 12 ++++++------ backends/platform/ds/arm9/source/osystem_ds.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'backends/platform/ds/arm9') diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp index b4bf38c45b..5c20deb359 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 d35b16c8fd..a6001da764 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>(); } -- cgit v1.2.3