aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/kvideo.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2010-11-11 19:22:56 +0000
committerFilippos Karapetis2010-11-11 19:22:56 +0000
commit8b14137c07bceda262e5423aadea830c761dc2bc (patch)
treee3feefa96d9fd5a55b6ac765dadc024a17edd33d /engines/sci/engine/kvideo.cpp
parentc624202c39215ea4b555567ee45abe01cac92133 (diff)
downloadscummvm-rg350-8b14137c07bceda262e5423aadea830c761dc2bc.tar.gz
scummvm-rg350-8b14137c07bceda262e5423aadea830c761dc2bc.tar.bz2
scummvm-rg350-8b14137c07bceda262e5423aadea830c761dc2bc.zip
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
Diffstat (limited to 'engines/sci/engine/kvideo.cpp')
-rw-r--r--engines/sci/engine/kvideo.cpp10
1 files changed, 6 insertions, 4 deletions
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);