aboutsummaryrefslogtreecommitdiff
path: root/video
diff options
context:
space:
mode:
authorJohannes Schickel2011-04-17 16:35:12 +0200
committerJohannes Schickel2011-04-17 16:35:12 +0200
commit5e279996eb1f448712d1a6b64218a6cf65159a57 (patch)
treefb71f76a3de9f4a7e39b8c04c13c3aa081d8da10 /video
parent2329a00873e2cea79dae2ffe1839501e05b39fe4 (diff)
downloadscummvm-rg350-5e279996eb1f448712d1a6b64218a6cf65159a57.tar.gz
scummvm-rg350-5e279996eb1f448712d1a6b64218a6cf65159a57.tar.bz2
scummvm-rg350-5e279996eb1f448712d1a6b64218a6cf65159a57.zip
VIDEO: Prefer Surface::create taking a PixelFormat over the one taking a byte depth.
Certain codecs seem to use a Surface with Bpp 2, but do not have any proper format description. Whoever is maintaining these should check this commit and fix the format properly.
Diffstat (limited to 'video')
-rw-r--r--video/codecs/cdtoons.cpp2
-rw-r--r--video/codecs/cinepak.cpp2
-rw-r--r--video/codecs/indeo3.cpp2
-rw-r--r--video/codecs/mjpeg.cpp2
-rw-r--r--video/codecs/msrle.cpp2
-rw-r--r--video/codecs/msvideo1.cpp3
-rw-r--r--video/codecs/qtrle.cpp2
-rw-r--r--video/codecs/rpza.cpp2
-rw-r--r--video/codecs/smc.cpp2
-rw-r--r--video/codecs/truemotion1.cpp3
-rw-r--r--video/coktel_decoder.cpp2
-rw-r--r--video/flic_decoder.cpp4
-rw-r--r--video/qt_decoder.cpp2
-rw-r--r--video/smk_decoder.cpp2
14 files changed, 17 insertions, 15 deletions
diff --git a/video/codecs/cdtoons.cpp b/video/codecs/cdtoons.cpp
index d4552b78d7..2d7920fb18 100644
--- a/video/codecs/cdtoons.cpp
+++ b/video/codecs/cdtoons.cpp
@@ -54,7 +54,7 @@ CDToonsDecoder::CDToonsDecoder(uint16 width, uint16 height) {
debugN(5, "CDToons: width %d, height %d\n", width, height);
_surface = new Graphics::Surface();
- _surface->create(width, height, 1);
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
_currentPaletteId = 0;
memset(_palette, 0, 256 * 3);
diff --git a/video/codecs/cinepak.cpp b/video/codecs/cinepak.cpp
index 2f5cb73561..28fcd67a03 100644
--- a/video/codecs/cinepak.cpp
+++ b/video/codecs/cinepak.cpp
@@ -89,7 +89,7 @@ const Graphics::Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream
if (!_curFrame.surface) {
_curFrame.surface = new Graphics::Surface();
- _curFrame.surface->create(_curFrame.width, _curFrame.height, _pixelFormat.bytesPerPixel);
+ _curFrame.surface->create(_curFrame.width, _curFrame.height, _pixelFormat);
}
// Reset the y variable.
diff --git a/video/codecs/indeo3.cpp b/video/codecs/indeo3.cpp
index e7f470bd3a..53ab56dd2d 100644
--- a/video/codecs/indeo3.cpp
+++ b/video/codecs/indeo3.cpp
@@ -51,7 +51,7 @@ Indeo3Decoder::Indeo3Decoder(uint16 width, uint16 height) : _ModPred(0), _correc
_pixelFormat = g_system->getScreenFormat();
_surface = new Graphics::Surface;
- _surface->create(width, height, _pixelFormat.bytesPerPixel);
+ _surface->create(width, height, _pixelFormat);
buildModPred();
allocFrames();
diff --git a/video/codecs/mjpeg.cpp b/video/codecs/mjpeg.cpp
index d6ec391a84..986b1079d3 100644
--- a/video/codecs/mjpeg.cpp
+++ b/video/codecs/mjpeg.cpp
@@ -53,7 +53,7 @@ const Graphics::Surface *JPEGDecoder::decodeImage(Common::SeekableReadStream* st
if (!_surface) {
_surface = new Graphics::Surface();
- _surface->create(_jpeg->getWidth(), _jpeg->getHeight(), _pixelFormat.bytesPerPixel);
+ _surface->create(_jpeg->getWidth(), _jpeg->getHeight(), _pixelFormat);
}
Graphics::Surface *frame = _jpeg->getSurface(_pixelFormat);
diff --git a/video/codecs/msrle.cpp b/video/codecs/msrle.cpp
index 46158c49d7..b750efa6a7 100644
--- a/video/codecs/msrle.cpp
+++ b/video/codecs/msrle.cpp
@@ -32,7 +32,7 @@ namespace Video {
MSRLEDecoder::MSRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) {
_surface = new Graphics::Surface();
- _surface->create(width, height, 1);
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
_bitsPerPixel = bitsPerPixel;
}
diff --git a/video/codecs/msvideo1.cpp b/video/codecs/msvideo1.cpp
index 2075d7f013..16041b5baa 100644
--- a/video/codecs/msvideo1.cpp
+++ b/video/codecs/msvideo1.cpp
@@ -38,7 +38,8 @@ namespace Video {
MSVideo1Decoder::MSVideo1Decoder(uint16 width, uint16 height, byte bitsPerPixel) : Codec() {
_surface = new Graphics::Surface();
- _surface->create(width, height, (bitsPerPixel == 8) ? 1 : 2);
+ // TODO: Specify the correct pixel format for 2Bpp mode.
+ _surface->create(width, height, (bitsPerPixel == 8) ? Graphics::PixelFormat::createFormatCLUT8() : Graphics::PixelFormat(2, 0, 0, 0, 0, 0, 0, 0, 0));
_bitsPerPixel = bitsPerPixel;
}
diff --git a/video/codecs/qtrle.cpp b/video/codecs/qtrle.cpp
index 26b2f02ce1..78267cc56e 100644
--- a/video/codecs/qtrle.cpp
+++ b/video/codecs/qtrle.cpp
@@ -48,7 +48,7 @@ QTRLEDecoder::QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel) : Cod
debug(2, "QTRLE corrected width: %d", width);
_surface = new Graphics::Surface();
- _surface->create(width, height, _bitsPerPixel <= 8 ? 1 : _pixelFormat.bytesPerPixel);
+ _surface->create(width, height, _bitsPerPixel <= 8 ? Graphics::PixelFormat::createFormatCLUT8() : _pixelFormat);
}
#define CHECK_STREAM_PTR(n) \
diff --git a/video/codecs/rpza.cpp b/video/codecs/rpza.cpp
index cc9739b673..c3a983004c 100644
--- a/video/codecs/rpza.cpp
+++ b/video/codecs/rpza.cpp
@@ -44,7 +44,7 @@ RPZADecoder::RPZADecoder(uint16 width, uint16 height) : Codec() {
debug(2, "RPZA corrected width: %d", width);
_surface = new Graphics::Surface();
- _surface->create(width, height, _pixelFormat.bytesPerPixel);
+ _surface->create(width, height, _pixelFormat);
}
RPZADecoder::~RPZADecoder() {
diff --git a/video/codecs/smc.cpp b/video/codecs/smc.cpp
index d03c60490f..2b45a67360 100644
--- a/video/codecs/smc.cpp
+++ b/video/codecs/smc.cpp
@@ -49,7 +49,7 @@ namespace Video {
SMCDecoder::SMCDecoder(uint16 width, uint16 height) {
_surface = new Graphics::Surface();
- _surface->create(width, height, 1);
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
}
SMCDecoder::~SMCDecoder() {
diff --git a/video/codecs/truemotion1.cpp b/video/codecs/truemotion1.cpp
index a0456869ab..a6483ec665 100644
--- a/video/codecs/truemotion1.cpp
+++ b/video/codecs/truemotion1.cpp
@@ -92,7 +92,8 @@ TrueMotion1Decoder::TrueMotion1Decoder(uint16 width, uint16 height) {
_width = width;
_height = height;
- _surface->create(width, height, 2);
+ // TODO: Use correct PixelFormat
+ _surface->create(width, height, Graphics::PixelFormat(2, 0, 0, 0, 0, 0, 0, 0, 0));
// there is a vertical predictor for each pixel in a line; each vertical
// predictor is 0 to start with
diff --git a/video/coktel_decoder.cpp b/video/coktel_decoder.cpp
index 0ab12e91cc..1727fbc7be 100644
--- a/video/coktel_decoder.cpp
+++ b/video/coktel_decoder.cpp
@@ -127,7 +127,7 @@ void CoktelDecoder::createSurface() {
return;
if ((_width > 0) && (_height > 0))
- _surface.create(_width, _height, getPixelFormat().bytesPerPixel);
+ _surface.create(_width, _height, getPixelFormat());
_ownSurface = true;
}
diff --git a/video/flic_decoder.cpp b/video/flic_decoder.cpp
index 90f7a8e9ac..38e82906ba 100644
--- a/video/flic_decoder.cpp
+++ b/video/flic_decoder.cpp
@@ -79,7 +79,7 @@ bool FlicDecoder::loadStream(Common::SeekableReadStream *stream) {
_offsetFrame2 = _fileStream->readUint32LE();
_surface = new Graphics::Surface();
- _surface->create(width, height, 1);
+ _surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
_palette = (byte *)malloc(3 * 256);
memset(_palette, 0, 3 * 256);
_paletteChanged = false;
@@ -226,7 +226,7 @@ const Graphics::Surface *FlicDecoder::decodeNextFrame() {
_surface->free();
delete _surface;
_surface = new Graphics::Surface();
- _surface->create(newWidth, newHeight, 1);
+ _surface->create(newWidth, newHeight, Graphics::PixelFormat::createFormatCLUT8());
}
}
break;
diff --git a/video/qt_decoder.cpp b/video/qt_decoder.cpp
index 826b7bfcaf..6c0c34a40c 100644
--- a/video/qt_decoder.cpp
+++ b/video/qt_decoder.cpp
@@ -526,7 +526,7 @@ void QuickTimeDecoder::init() {
if (getScaleFactorX() != 1 || getScaleFactorY() != 1) {
// We have to initialize the scaled surface
_scaledSurface = new Graphics::Surface();
- _scaledSurface->create(getWidth(), getHeight(), getPixelFormat().bytesPerPixel);
+ _scaledSurface->create(getWidth(), getHeight(), getPixelFormat());
}
}
}
diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp
index 760d0045d9..6e82b0ede9 100644
--- a/video/smk_decoder.cpp
+++ b/video/smk_decoder.cpp
@@ -483,7 +483,7 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) {
_surface = new Graphics::Surface();
// Height needs to be doubled if we have flags (Y-interlaced or Y-doubled)
- _surface->create(width, height * (_header.flags ? 2 : 1), 1);
+ _surface->create(width, height * (_header.flags ? 2 : 1), Graphics::PixelFormat::createFormatCLUT8());
memset(_palette, 0, 3 * 256);
return true;