diff options
author | Johannes Schickel | 2012-06-16 04:17:14 +0200 |
---|---|---|
committer | Johannes Schickel | 2012-06-16 04:17:14 +0200 |
commit | aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95 (patch) | |
tree | 94d1ddb5cf823bb08d86161f9e5415c54011a0ea /backends/graphics/surfacesdl | |
parent | 99229fc7ab3a15da8b964443cb58bc00caa5f0a4 (diff) | |
download | scummvm-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/graphics/surfacesdl')
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 20 | ||||
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.h | 4 |
2 files changed, 14 insertions, 10 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index cdbe6293e4..fb964d6951 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 f387c213fb..21444cc25d 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; } |