From bd3f9ad1e21a791dafee1943099492d6b49d32be Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 20 Jan 2011 05:19:41 +0000 Subject: GOB: Use Surface::blit() in VideoPlayer::copyFrame() svn-id: r55344 --- engines/gob/videoplayer.cpp | 56 ++++----------------------------------------- 1 file changed, 5 insertions(+), 51 deletions(-) (limited to 'engines/gob/videoplayer.cpp') 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(width , surface->w); - int32 h = MIN(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; } -- cgit v1.2.3