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.
This commit is contained in:
parent
2329a00873
commit
5e279996eb
14 changed files with 17 additions and 15 deletions
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue