From 9285986e62c5bf4985dc2680d1393e67d65c6656 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 16 Dec 2010 02:02:53 +0000 Subject: VIDEO: Make Codec::decodeImage() return a const Surface pointer svn-id: r54930 --- graphics/video/avi_decoder.cpp | 2 +- graphics/video/codecs/cinepak.cpp | 2 +- graphics/video/codecs/cinepak.h | 2 +- graphics/video/codecs/codec.h | 2 +- graphics/video/codecs/indeo3.cpp | 2 +- graphics/video/codecs/indeo3.h | 2 +- graphics/video/codecs/mjpeg.cpp | 2 +- graphics/video/codecs/mjpeg.h | 2 +- graphics/video/codecs/msrle.cpp | 2 +- graphics/video/codecs/msrle.h | 2 +- graphics/video/codecs/msvideo1.cpp | 2 +- graphics/video/codecs/msvideo1.h | 2 +- graphics/video/codecs/qtrle.cpp | 2 +- graphics/video/codecs/qtrle.h | 2 +- graphics/video/codecs/rpza.cpp | 2 +- graphics/video/codecs/rpza.h | 2 +- graphics/video/codecs/smc.cpp | 2 +- graphics/video/codecs/smc.h | 2 +- graphics/video/codecs/truemotion1.cpp | 2 +- graphics/video/codecs/truemotion1.h | 2 +- graphics/video/coktel_decoder.cpp | 2 +- graphics/video/qt_decoder.cpp | 4 ++-- graphics/video/qt_decoder.h | 2 +- 23 files changed, 24 insertions(+), 24 deletions(-) diff --git a/graphics/video/avi_decoder.cpp b/graphics/video/avi_decoder.cpp index c1346bbe12..ed0b063147 100644 --- a/graphics/video/avi_decoder.cpp +++ b/graphics/video/avi_decoder.cpp @@ -357,7 +357,7 @@ const Surface *AviDecoder::decodeNextFrame() { return NULL; Common::SeekableReadStream *frameData = _fileStream->readStream(chunkSize); - Graphics::Surface *surface = _videoCodec->decodeImage(frameData); + const Graphics::Surface *surface = _videoCodec->decodeImage(frameData); delete frameData; _fileStream->skip(chunkSize & 1); // Alignment return surface; diff --git a/graphics/video/codecs/cinepak.cpp b/graphics/video/codecs/cinepak.cpp index b6903cf201..3264810908 100644 --- a/graphics/video/codecs/cinepak.cpp +++ b/graphics/video/codecs/cinepak.cpp @@ -68,7 +68,7 @@ CinepakDecoder::~CinepakDecoder() { delete[] _curFrame.strips; } -Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *stream) { +const Surface *CinepakDecoder::decodeImage(Common::SeekableReadStream *stream) { _curFrame.flags = stream->readByte(); _curFrame.length = (stream->readByte() << 16) + stream->readUint16BE(); _curFrame.width = stream->readUint16BE(); diff --git a/graphics/video/codecs/cinepak.h b/graphics/video/codecs/cinepak.h index 0c42cbbb97..b1daece1f3 100644 --- a/graphics/video/codecs/cinepak.h +++ b/graphics/video/codecs/cinepak.h @@ -64,7 +64,7 @@ public: CinepakDecoder(int bitsPerPixel = 24); ~CinepakDecoder(); - Surface *decodeImage(Common::SeekableReadStream *stream); + const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const { return _pixelFormat; } private: diff --git a/graphics/video/codecs/codec.h b/graphics/video/codecs/codec.h index 802671a037..565faf8442 100644 --- a/graphics/video/codecs/codec.h +++ b/graphics/video/codecs/codec.h @@ -40,7 +40,7 @@ public: Codec() {} virtual ~Codec() {} - virtual Surface *decodeImage(Common::SeekableReadStream *stream) = 0; + virtual const Surface *decodeImage(Common::SeekableReadStream *stream) = 0; virtual PixelFormat getPixelFormat() const = 0; }; diff --git a/graphics/video/codecs/indeo3.cpp b/graphics/video/codecs/indeo3.cpp index 443340de2f..51e946a75b 100644 --- a/graphics/video/codecs/indeo3.cpp +++ b/graphics/video/codecs/indeo3.cpp @@ -168,7 +168,7 @@ void Indeo3Decoder::allocFrames() { } } -Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream *stream) { +const Surface *Indeo3Decoder::decodeImage(Common::SeekableReadStream *stream) { // Not Indeo 3? Fail if (!isIndeo3(*stream)) return 0; diff --git a/graphics/video/codecs/indeo3.h b/graphics/video/codecs/indeo3.h index 319a8e5d42..d074facea2 100644 --- a/graphics/video/codecs/indeo3.h +++ b/graphics/video/codecs/indeo3.h @@ -46,7 +46,7 @@ public: Indeo3Decoder(uint16 width, uint16 height); ~Indeo3Decoder(); - Surface *decodeImage(Common::SeekableReadStream *stream); + const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const; static bool isIndeo3(Common::SeekableReadStream &stream); diff --git a/graphics/video/codecs/mjpeg.cpp b/graphics/video/codecs/mjpeg.cpp index 76363036ee..1efaa6ac19 100644 --- a/graphics/video/codecs/mjpeg.cpp +++ b/graphics/video/codecs/mjpeg.cpp @@ -45,7 +45,7 @@ JPEGDecoder::~JPEGDecoder() { } } -Surface *JPEGDecoder::decodeImage(Common::SeekableReadStream* stream) { +const Surface *JPEGDecoder::decodeImage(Common::SeekableReadStream* stream) { _jpeg->read(stream); Surface *ySurface = _jpeg->getComponent(1); Surface *uSurface = _jpeg->getComponent(2); diff --git a/graphics/video/codecs/mjpeg.h b/graphics/video/codecs/mjpeg.h index 8b0a03609b..daa8b12dbb 100644 --- a/graphics/video/codecs/mjpeg.h +++ b/graphics/video/codecs/mjpeg.h @@ -43,7 +43,7 @@ public: JPEGDecoder(); ~JPEGDecoder(); - Surface *decodeImage(Common::SeekableReadStream *stream); + const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const { return _pixelFormat; } private: diff --git a/graphics/video/codecs/msrle.cpp b/graphics/video/codecs/msrle.cpp index f7dcaf7467..a3929fc1fd 100644 --- a/graphics/video/codecs/msrle.cpp +++ b/graphics/video/codecs/msrle.cpp @@ -41,7 +41,7 @@ MSRLEDecoder::~MSRLEDecoder() { delete _surface; } -Surface *MSRLEDecoder::decodeImage(Common::SeekableReadStream *stream) { +const Surface *MSRLEDecoder::decodeImage(Common::SeekableReadStream *stream) { if (_bitsPerPixel == 8) { decode8(stream); } else diff --git a/graphics/video/codecs/msrle.h b/graphics/video/codecs/msrle.h index 819e66a0bd..02b9199e4e 100644 --- a/graphics/video/codecs/msrle.h +++ b/graphics/video/codecs/msrle.h @@ -35,7 +35,7 @@ public: MSRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel); ~MSRLEDecoder(); - Surface *decodeImage(Common::SeekableReadStream *stream); + const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } private: diff --git a/graphics/video/codecs/msvideo1.cpp b/graphics/video/codecs/msvideo1.cpp index 8cb1e75058..176efc037f 100644 --- a/graphics/video/codecs/msvideo1.cpp +++ b/graphics/video/codecs/msvideo1.cpp @@ -126,7 +126,7 @@ void MSVideo1Decoder::decode8(Common::SeekableReadStream *stream) { } } -Surface *MSVideo1Decoder::decodeImage(Common::SeekableReadStream *stream) { +const Surface *MSVideo1Decoder::decodeImage(Common::SeekableReadStream *stream) { if (_bitsPerPixel == 8) decode8(stream); else { diff --git a/graphics/video/codecs/msvideo1.h b/graphics/video/codecs/msvideo1.h index e07267476d..1b908a6243 100644 --- a/graphics/video/codecs/msvideo1.h +++ b/graphics/video/codecs/msvideo1.h @@ -35,7 +35,7 @@ public: MSVideo1Decoder(uint16 width, uint16 height, byte bitsPerPixel); ~MSVideo1Decoder(); - Surface *decodeImage(Common::SeekableReadStream *stream); + const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } private: diff --git a/graphics/video/codecs/qtrle.cpp b/graphics/video/codecs/qtrle.cpp index 3e3fd4cfce..e73d193896 100644 --- a/graphics/video/codecs/qtrle.cpp +++ b/graphics/video/codecs/qtrle.cpp @@ -354,7 +354,7 @@ void QTRLEDecoder::decode32(Common::SeekableReadStream *stream, uint32 rowPtr, u } } -Surface *QTRLEDecoder::decodeImage(Common::SeekableReadStream *stream) { +const Surface *QTRLEDecoder::decodeImage(Common::SeekableReadStream *stream) { uint16 start_line = 0; uint16 height = _surface->h; diff --git a/graphics/video/codecs/qtrle.h b/graphics/video/codecs/qtrle.h index efbef14411..f0d2587f30 100644 --- a/graphics/video/codecs/qtrle.h +++ b/graphics/video/codecs/qtrle.h @@ -36,7 +36,7 @@ public: QTRLEDecoder(uint16 width, uint16 height, byte bitsPerPixel); ~QTRLEDecoder(); - Surface *decodeImage(Common::SeekableReadStream *stream); + const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const { return _pixelFormat; } private: diff --git a/graphics/video/codecs/rpza.cpp b/graphics/video/codecs/rpza.cpp index 050f2a5bcf..7212aba64c 100644 --- a/graphics/video/codecs/rpza.cpp +++ b/graphics/video/codecs/rpza.cpp @@ -69,7 +69,7 @@ RPZADecoder::RPZADecoder(uint16 width, uint16 height) : Codec() { } \ blockPtr++ -Surface *RPZADecoder::decodeImage(Common::SeekableReadStream *stream) { +const Surface *RPZADecoder::decodeImage(Common::SeekableReadStream *stream) { uint16 colorA = 0, colorB = 0; uint16 color4[4]; diff --git a/graphics/video/codecs/rpza.h b/graphics/video/codecs/rpza.h index e6d32feb72..7a5f2033eb 100644 --- a/graphics/video/codecs/rpza.h +++ b/graphics/video/codecs/rpza.h @@ -36,7 +36,7 @@ public: RPZADecoder(uint16 width, uint16 height); ~RPZADecoder() { delete _surface; } - Surface *decodeImage(Common::SeekableReadStream *stream); + const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const { return _pixelFormat; } private: diff --git a/graphics/video/codecs/smc.cpp b/graphics/video/codecs/smc.cpp index 425922435d..2f75f5f21e 100644 --- a/graphics/video/codecs/smc.cpp +++ b/graphics/video/codecs/smc.cpp @@ -52,7 +52,7 @@ SMCDecoder::SMCDecoder(uint16 width, uint16 height) { _surface->create(width, height, 1); } -Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) { +const Graphics::Surface *SMCDecoder::decodeImage(Common::SeekableReadStream *stream) { byte *pixels = (byte *)_surface->pixels; uint32 numBlocks = 0; diff --git a/graphics/video/codecs/smc.h b/graphics/video/codecs/smc.h index 2d4355a83e..c2ade00141 100644 --- a/graphics/video/codecs/smc.h +++ b/graphics/video/codecs/smc.h @@ -42,7 +42,7 @@ public: SMCDecoder(uint16 width, uint16 height); ~SMCDecoder() { delete _surface; } - Surface *decodeImage(Common::SeekableReadStream *stream); + const Surface *decodeImage(Common::SeekableReadStream *stream); PixelFormat getPixelFormat() const { return PixelFormat::createFormatCLUT8(); } private: diff --git a/graphics/video/codecs/truemotion1.cpp b/graphics/video/codecs/truemotion1.cpp index fde9f5c2c8..d244014fff 100644 --- a/graphics/video/codecs/truemotion1.cpp +++ b/graphics/video/codecs/truemotion1.cpp @@ -395,7 +395,7 @@ void TrueMotion1Decoder::decode16() { } } -Surface *TrueMotion1Decoder::decodeImage(Common::SeekableReadStream *stream) { +const Surface *TrueMotion1Decoder::decodeImage(Common::SeekableReadStream *stream) { decodeHeader(stream); if (compressionTypes[_header.compression].algorithm == ALGO_NOP) diff --git a/graphics/video/codecs/truemotion1.h b/graphics/video/codecs/truemotion1.h index 0e77ec3e26..ab8fb221f8 100644 --- a/graphics/video/codecs/truemotion1.h +++ b/graphics/video/codecs/truemotion1.h @@ -40,7 +40,7 @@ public: TrueMotion1Decoder(uint16 width, uint16 height); ~TrueMotion1Decoder(); - Surface *decodeImage(Common::SeekableReadStream *stream); + const Surface *decodeImage(Common::SeekableReadStream *stream); // Always return RGB565 PixelFormat getPixelFormat() const { return Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); } diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp index e26ec33048..d6ad6327e0 100644 --- a/graphics/video/coktel_decoder.cpp +++ b/graphics/video/coktel_decoder.cpp @@ -2093,7 +2093,7 @@ bool VMDDecoder::renderFrame(Common::Rect &rect) { return false; Common::MemoryReadStream frameStream(_frameData, _frameDataLen); - Surface *codecSurf = _codec->decodeImage(&frameStream); + const Surface *codecSurf = _codec->decodeImage(&frameStream); if (!codecSurf) return false; diff --git a/graphics/video/qt_decoder.cpp b/graphics/video/qt_decoder.cpp index b8dc4c3d11..2e18050db1 100644 --- a/graphics/video/qt_decoder.cpp +++ b/graphics/video/qt_decoder.cpp @@ -242,7 +242,7 @@ const Surface *QuickTimeDecoder::decodeNextFrame() { if (!entry->videoCodec) return 0; - Surface *frame = entry->videoCodec->decodeImage(frameData); + const Surface *frame = entry->videoCodec->decodeImage(frameData); delete frameData; // Update the palette in case it changes between video descriptions @@ -256,7 +256,7 @@ const Surface *QuickTimeDecoder::decodeNextFrame() { return scaleSurface(frame); } -Surface *QuickTimeDecoder::scaleSurface(Surface *frame) { +const Surface *QuickTimeDecoder::scaleSurface(const Surface *frame) { if (getScaleFactorX() == 1 && getScaleFactorY() == 1) return frame; diff --git a/graphics/video/qt_decoder.h b/graphics/video/qt_decoder.h index fcb75bb4f0..b56aaebdeb 100644 --- a/graphics/video/qt_decoder.h +++ b/graphics/video/qt_decoder.h @@ -251,7 +251,7 @@ private: int8 _videoStreamIndex; Surface *_scaledSurface; - Surface *scaleSurface(Surface *frame); + const Surface *scaleSurface(const Surface *frame); Common::Rational getScaleFactorX() const; Common::Rational getScaleFactorY() const; -- cgit v1.2.3