[Scummvm-cvs-logs] SF.net SVN: scummvm:[54932] scummvm/trunk/graphics/video
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Thu Dec 16 14:25:29 CET 2010
Revision: 54932
http://scummvm.svn.sourceforge.net/scummvm/?rev=54932&view=rev
Author: mthreepwood
Date: 2010-12-16 13:25:29 +0000 (Thu, 16 Dec 2010)
Log Message:
-----------
VIDEO: Extend Codec to support internal palettes
Modified Paths:
--------------
scummvm/trunk/graphics/video/codecs/codec.h
scummvm/trunk/graphics/video/qt_decoder.cpp
scummvm/trunk/graphics/video/qt_decoder.h
Modified: scummvm/trunk/graphics/video/codecs/codec.h
===================================================================
--- scummvm/trunk/graphics/video/codecs/codec.h 2010-12-16 08:03:19 UTC (rev 54931)
+++ scummvm/trunk/graphics/video/codecs/codec.h 2010-12-16 13:25:29 UTC (rev 54932)
@@ -42,6 +42,10 @@
virtual const Surface *decodeImage(Common::SeekableReadStream *stream) = 0;
virtual PixelFormat getPixelFormat() const = 0;
+
+ virtual bool containsPalette() const { return false; }
+ virtual const byte *getPalette() { return 0; }
+ virtual bool hasDirtyPalette() const { return false; }
};
} // End of namespace Graphics
Modified: scummvm/trunk/graphics/video/qt_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/qt_decoder.cpp 2010-12-16 08:03:19 UTC (rev 54931)
+++ scummvm/trunk/graphics/video/qt_decoder.cpp 2010-12-16 13:25:29 UTC (rev 54932)
@@ -245,12 +245,21 @@
const Surface *frame = entry->videoCodec->decodeImage(frameData);
delete frameData;
- // Update the palette in case it changes between video descriptions
- byte *palette = entry->palette;
+ // Update the palette
+ if (entry->videoCodec->containsPalette()) {
+ // The codec itself contains a palette
+ if (entry->videoCodec->hasDirtyPalette()) {
+ _palette = entry->videoCodec->getPalette();
+ _dirtyPalette = true;
+ }
+ } else {
+ // Check if the video description has been updated
+ byte *palette = entry->palette;
- if (palette != _palette) {
- _palette = palette;
- _dirtyPalette = true;
+ if (palette != _palette) {
+ _palette = palette;
+ _dirtyPalette = true;
+ }
}
return scaleSurface(frame);
Modified: scummvm/trunk/graphics/video/qt_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/qt_decoder.h 2010-12-16 08:03:19 UTC (rev 54931)
+++ scummvm/trunk/graphics/video/qt_decoder.h 2010-12-16 13:25:29 UTC (rev 54932)
@@ -224,7 +224,7 @@
Common::Rational _scaleFactorX;
Common::Rational _scaleFactorY;
MOVStreamContext *_streams[20];
- byte *_palette;
+ const byte *_palette;
bool _dirtyPalette;
uint32 _beginOffset;
Common::MacResManager *_resFork;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list