aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/screen.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/graphics/screen.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/graphics/screen.cpp')
-rw-r--r--engines/sci/graphics/screen.cpp41
1 files changed, 31 insertions, 10 deletions
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index f8dc3118b5..5a96a3167f 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -654,20 +654,41 @@ void GfxScreen::debugShowMap(int mapNo) {
copyToScreen();
}
-void GfxScreen::scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight) {
+void GfxScreen::scale2x(const byte *src, byte *dst, int16 srcWidth, int16 srcHeight, byte bytesPerPixel) {
+ assert(bytesPerPixel == 1 || bytesPerPixel == 2);
const int newWidth = srcWidth * 2;
+ const int pitch = newWidth * bytesPerPixel;
const byte *srcPtr = src;
- for (int y = 0; y < srcHeight; y++) {
- for (int x = 0; x < srcWidth; x++) {
- const byte color = *srcPtr++;
- dst[0] = color;
- dst[1] = color;
- dst[newWidth] = color;
- dst[newWidth + 1] = color;
- dst += 2;
+ if (bytesPerPixel == 1) {
+ for (int y = 0; y < srcHeight; y++) {
+ for (int x = 0; x < srcWidth; x++) {
+ const byte color = *srcPtr++;
+ dst[0] = color;
+ dst[1] = color;
+ dst[newWidth] = color;
+ dst[newWidth + 1] = color;
+ dst += 2;
+ }
+ dst += newWidth;
+ }
+ } else if (bytesPerPixel == 2) {
+ for (int y = 0; y < srcHeight; y++) {
+ for (int x = 0; x < srcWidth; x++) {
+ const byte color = *srcPtr++;
+ const byte color2 = *srcPtr++;
+ dst[0] = color;
+ dst[1] = color2;
+ dst[2] = color;
+ dst[3] = color2;
+ dst[pitch] = color;
+ dst[pitch + 1] = color2;
+ dst[pitch + 2] = color;
+ dst[pitch + 3] = color2;
+ dst += 4;
+ }
+ dst += pitch;
}
- dst += newWidth;
}
}