From 8b14137c07bceda262e5423aadea830c761dc2bc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 11 Nov 2010 19:22:56 +0000 Subject: SCI: Some video related changes - Now playVideo() is used when playing videos from the console (reducing code duplication) - Added support for 16bpp scaling in scale2x, so that the 16-bit color Duck videos are scaled correctly svn-id: r54210 --- engines/sci/engine/kvideo.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'engines/sci/engine/kvideo.cpp') diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index 49b5e39eeb..9245572bbf 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -44,16 +44,18 @@ void playVideo(Graphics::VideoDecoder *videoDecoder) { return; byte *scaleBuffer = 0; + byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel; uint16 width = videoDecoder->getWidth(); uint16 height = videoDecoder->getHeight(); + uint16 pitch = videoDecoder->getWidth() * bytesPerPixel; uint16 screenWidth = g_system->getWidth(); uint16 screenHeight = g_system->getHeight(); if (screenWidth == 640 && width <= 320 && height <= 240) { - assert(videoDecoder->getPixelFormat().bytesPerPixel == 1); width *= 2; height *= 2; - scaleBuffer = new byte[width * height]; + pitch *= 2; + scaleBuffer = new byte[width * height * bytesPerPixel]; } uint16 x = (screenWidth - width) / 2; @@ -69,8 +71,8 @@ void playVideo(Graphics::VideoDecoder *videoDecoder) { if (frame) { if (scaleBuffer) { // TODO: Probably should do aspect ratio correction in e.g. GK1 Windows - g_sci->_gfxScreen->scale2x((byte *)frame->pixels, scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight()); - g_system->copyRectToScreen(scaleBuffer, width, x, y, width, height); + g_sci->_gfxScreen->scale2x((byte *)frame->pixels, scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel); + g_system->copyRectToScreen(scaleBuffer, pitch, x, y, width, height); } else g_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, width, height); -- cgit v1.2.3