From 690d55d763ed0c771dde7ff025fbe0c9f3d26228 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 2 Aug 2013 23:32:31 +0200 Subject: GOB: Prefer getBasePtr over direct Surface::pixels access. --- engines/gob/videoplayer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engines/gob/videoplayer.cpp') 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(surface->getBasePtr(0, 0))); dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp); return true; -- cgit v1.2.3 From 63a2e47bfe2a0be8bc717a4274e94f78a98a9000 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 3 Aug 2013 02:39:04 +0200 Subject: GOB: Take advantage of Surface::getPixels. --- engines/gob/videoplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/gob/videoplayer.cpp') diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 8d37c59a85..155989ccee 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -738,7 +738,7 @@ bool VideoPlayer::copyFrame(int slot, Surface &dest, // 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(surface->getBasePtr(0, 0))); + Surface src(surface->w, surface->h, surface->format.bytesPerPixel, (byte *)const_cast(surface->getPixels())); dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp); return true; -- cgit v1.2.3