aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ds/arm9
diff options
context:
space:
mode:
authorJohannes Schickel2012-06-20 08:02:26 -0700
committerJohannes Schickel2012-06-20 08:02:26 -0700
commit4fb9bceabc4309a477472aa55207eae55bc0aa13 (patch)
tree1e119f6d63d0a4c5c38a7caabd92be335749f07d /backends/platform/ds/arm9
parent5a2e65469f3650dc9785bf27b77d25d285ded4f1 (diff)
parentaec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95 (diff)
downloadscummvm-rg350-4fb9bceabc4309a477472aa55207eae55bc0aa13.tar.gz
scummvm-rg350-4fb9bceabc4309a477472aa55207eae55bc0aa13.tar.bz2
scummvm-rg350-4fb9bceabc4309a477472aa55207eae55bc0aa13.zip
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
Diffstat (limited to 'backends/platform/ds/arm9')
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp16
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h8
2 files changed, 12 insertions, 12 deletions
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index b72d959606..a4b9c842fc 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;
@@ -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?)
/*
@@ -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 11b0988666..a6001da764 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -98,15 +98,15 @@ 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);
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>(); }
@@ -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();