aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/videoplayer.cpp
diff options
context:
space:
mode:
authorSven Hesse2011-01-20 05:19:41 +0000
committerSven Hesse2011-01-20 05:19:41 +0000
commitbd3f9ad1e21a791dafee1943099492d6b49d32be (patch)
tree3b9f88ea1d9e10159f0944985ef44a83143a4393 /engines/gob/videoplayer.cpp
parent82b0a9b003b8bcbe0eff8789acd19cbcd1cf7575 (diff)
downloadscummvm-rg350-bd3f9ad1e21a791dafee1943099492d6b49d32be.tar.gz
scummvm-rg350-bd3f9ad1e21a791dafee1943099492d6b49d32be.tar.bz2
scummvm-rg350-bd3f9ad1e21a791dafee1943099492d6b49d32be.zip
GOB: Use Surface::blit() in VideoPlayer::copyFrame()
svn-id: r55344
Diffstat (limited to 'engines/gob/videoplayer.cpp')
-rw-r--r--engines/gob/videoplayer.cpp56
1 files changed, 5 insertions, 51 deletions
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index 8ac4c47202..a7284feb66 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -611,9 +611,9 @@ void VideoPlayer::writeVideoInfo(const Common::String &file, int16 varX, int16 v
}
}
-bool VideoPlayer::copyFrame(int slot, byte *dest,
- uint16 left, uint16 top, uint16 width, uint16 height,
- uint16 x, uint16 y, uint16 pitch, uint8 bpp, int16 transp) const {
+bool VideoPlayer::copyFrame(int slot, Surface &dest,
+ uint16 left, uint16 top, uint16 width, uint16 height, uint16 x, uint16 y,
+ int32 transp) const {
const Video *video = getVideoBySlot(slot);
if (!video)
@@ -623,55 +623,9 @@ bool VideoPlayer::copyFrame(int slot, byte *dest,
if (!surface)
return false;
- assert(surface->bytesPerPixel == bpp);
-
- int32 w = MIN<int32>(width , surface->w);
- int32 h = MIN<int32>(height, surface->h);
-
- const byte *src = (byte*)surface->pixels + (top * surface->pitch) + left;
- byte *dst = dest + (y * pitch) + x;
-
- if (transp < 0) {
- // No transparency
-
- if ((x == 0) && (left == 0) && (pitch == surface->pitch) && (width == surface->w)) {
- // Dimensions fit, we can copy everything at once
-
- memcpy(dst, src, w * h * bpp);
- return true;
- }
-
- // Copy row-by-row
-
- while (h-- > 0) {
- const byte *srcRow = src;
- byte *dstRow = dst;
-
- memcpy(dstRow, srcRow, w * bpp);
-
- src += surface->pitch;
- dst += pitch;
- }
-
- return true;
- }
-
- // Copy pixel-by-pixel
-
- assert(bpp == 1);
-
- while (h-- > 0) {
- const byte *srcRow = src;
- byte *dstRow = dst;
-
- for (int32 i = 0; i < w; i++, srcRow++, dstRow++)
- if (*srcRow != transp)
- *dstRow = *srcRow;
-
- src += surface->pitch;
- dst += pitch;
- }
+ Surface src(surface->w, surface->h, surface->bytesPerPixel, (byte *)surface->pixels);
+ dest.blit(src, left, top, left + width - 1, top + height - 1, x, y, transp);
return true;
}