aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2013-08-02 23:32:31 +0200
committerJohannes Schickel2013-08-03 02:52:32 +0200
commit690d55d763ed0c771dde7ff025fbe0c9f3d26228 (patch)
tree1da11c526758a14bd2d93214b13a9b4049cdec8c /engines
parent2131d2d2f5a2142bd537cf853a6d9b9cd867357c (diff)
downloadscummvm-rg350-690d55d763ed0c771dde7ff025fbe0c9f3d26228.tar.gz
scummvm-rg350-690d55d763ed0c771dde7ff025fbe0c9f3d26228.tar.bz2
scummvm-rg350-690d55d763ed0c771dde7ff025fbe0c9f3d26228.zip
GOB: Prefer getBasePtr over direct Surface::pixels access.
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/surface.cpp2
-rw-r--r--engines/gob/videoplayer.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp
index 839378a412..0090045b45 100644
--- a/engines/gob/surface.cpp
+++ b/engines/gob/surface.cpp
@@ -821,7 +821,7 @@ bool Surface::loadIFF(Common::SeekableReadStream &stream) {
return false;
resize(decoder.getSurface()->w, decoder.getSurface()->h);
- memcpy(_vidMem, decoder.getSurface()->pixels, decoder.getSurface()->w * decoder.getSurface()->h);
+ memcpy(_vidMem, decoder.getSurface()->getBasePtr(0, 0), decoder.getSurface()->w * decoder.getSurface()->h);
return true;
}
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index a478492ccc..8d37c59a85 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -734,7 +734,11 @@ bool VideoPlayer::copyFrame(int slot, Surface &dest,
if (!surface)
return false;
- Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)surface->pixels);
+ // FIXME? This currently casts away const from the pixel data. However, it
+ // is only used read-only in this case (as far as I can tell). Not casting
+ // the const qualifier away will lead to an additional allocation and copy
+ // of the frame data which is undesirable.
+ Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)const_cast<void *>(surface->getBasePtr(0, 0)));
dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp);
return true;