aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2012-06-16 02:18:01 +0200
committerJohannes Schickel2012-06-16 02:18:01 +0200
commit31880186e1c78023e2e552a7fceaa27c3d2d08b1 (patch)
tree08f62b1b8d032a490e1d3d63f33814ed93785439 /backends/graphics/surfacesdl/surfacesdl-graphics.cpp
parentf917db972e0ae7e4e82a6430010a155cbb3a92c0 (diff)
downloadscummvm-rg350-31880186e1c78023e2e552a7fceaa27c3d2d08b1.tar.gz
scummvm-rg350-31880186e1c78023e2e552a7fceaa27c3d2d08b1.tar.bz2
scummvm-rg350-31880186e1c78023e2e552a7fceaa27c3d2d08b1.zip
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.
Diffstat (limited to 'backends/graphics/surfacesdl/surfacesdl-graphics.cpp')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 652c08dc45..9244135262 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -1227,9 +1227,9 @@ void SurfaceSdlGraphicsManager::setAspectRatioCorrection(bool enable) {
}
}
-void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
+void SurfaceSdlGraphicsManager::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
assert(_transactionMode == kTransactionNone);
- assert(src);
+ assert(buf);
if (_screen == NULL) {
warning("SurfaceSdlGraphicsManager::copyRectToScreen: _screen == NULL");
@@ -1252,8 +1252,9 @@ void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int
#ifdef USE_RGB_COLOR
byte *dst = (byte *)_screen->pixels + y * _screen->pitch + x * _screenFormat.bytesPerPixel;
if (_videoMode.screenWidth == w && pitch == _screen->pitch) {
- memcpy(dst, src, h*pitch);
+ memcpy(dst, buf, h*pitch);
} else {
+ const byte *src = (const byte *)buf;
do {
memcpy(dst, src, w * _screenFormat.bytesPerPixel);
src += pitch;
@@ -1263,8 +1264,9 @@ void SurfaceSdlGraphicsManager::copyRectToScreen(const byte *src, int pitch, int
#else
byte *dst = (byte *)_screen->pixels + y * _screen->pitch + x;
if (_screen->pitch == pitch && pitch == w) {
- memcpy(dst, src, h*w);
+ memcpy(dst, buf, h*w);
} else {
+ const byte *src = (const byte *)buf;
do {
memcpy(dst, src, w);
src += pitch;