From 25496abe1b494e125cc8dd7892e9c95e3da61042 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 17 Jun 2010 07:53:57 +0000 Subject: Added 2x scaling for VMD videos, for bugtesting (temporarily in SCI itself). It's currently not optimized much, but since the VMD decoder code will be revamped, we don't really care about performance at this point svn-id: r49921 --- engines/sci/engine/kgraphics.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 84fbbe98eb..41aca3ff49 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -1253,15 +1253,27 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) { g_sci->_gfxCursor->kernelHide(); if (videoDecoder && videoDecoder->loadFile(fileName)) { - uint16 x = (g_system->getWidth() - videoDecoder->getWidth()) / 2; - uint16 y = (g_system->getHeight() - videoDecoder->getHeight()) / 2; + //uint16 x = (g_system->getWidth() - videoDecoder->getWidth()) / 2; + //uint16 y = (g_system->getHeight() - videoDecoder->getHeight()) / 2; + uint16 w = videoDecoder->getWidth() * 2; + uint16 h = videoDecoder->getHeight() * 2; + uint16 x = (g_system->getWidth() - w) / 2; + uint16 y = (g_system->getHeight() - h) / 2; + byte *frameBuf = new byte[w * h]; + bool skipVideo = false; while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { if (videoDecoder->needsUpdate()) { Graphics::Surface *frame = videoDecoder->decodeNextFrame(); + if (frame) { - g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h); + //g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h); + // All the VMD videos in SCI2.1 need to be scaled by 2 + // TODO: This isn't optimized much, but since the VMD decoder code will be revamped, we + // don't really care about performance at this point anyway + g_sci->_gfxScreen->scale2x((byte *)frame->pixels, frameBuf, videoDecoder->getWidth(), videoDecoder->getHeight()); + g_system->copyRectToScreen(frameBuf, frame->pitch * 2, x, y, frame->w * 2, frame->h * 2); if (videoDecoder->hasDirtyPalette()) videoDecoder->setSystemPalette(); @@ -1282,6 +1294,7 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv) { // Copy video contents to screen buffer g_sci->_gfxScreen->kernelSyncWithFramebuffer(); + delete frameBuf; delete videoDecoder; } else warning("Could not play video %s\n", fileName.c_str()); -- cgit v1.2.3