diff options
author | Matthew Hoops | 2014-08-18 18:31:38 -0400 |
---|---|---|
committer | Matthew Hoops | 2015-04-11 14:36:37 -0400 |
commit | f342d63431fc0784adc08648f17a6bbad934743f (patch) | |
tree | 1521c7bfe83d7528c05d58e3e2219b8b7d9e83a6 /image | |
parent | ad32fb58326657b05731681b1a8945978928ef55 (diff) | |
download | scummvm-rg350-f342d63431fc0784adc08648f17a6bbad934743f.tar.gz scummvm-rg350-f342d63431fc0784adc08648f17a6bbad934743f.tar.bz2 scummvm-rg350-f342d63431fc0784adc08648f17a6bbad934743f.zip |
IMAGE: Allow for choosing dither type
Diffstat (limited to 'image')
-rw-r--r-- | image/codecs/cinepak.cpp | 8 | ||||
-rw-r--r-- | image/codecs/cinepak.h | 4 | ||||
-rw-r--r-- | image/codecs/codec.h | 19 |
3 files changed, 19 insertions, 12 deletions
diff --git a/image/codecs/cinepak.cpp b/image/codecs/cinepak.cpp index 9760b5b2a4..de5198812b 100644 --- a/image/codecs/cinepak.cpp +++ b/image/codecs/cinepak.cpp @@ -320,12 +320,12 @@ void CinepakDecoder::decodeVectors(Common::SeekableReadStream &stream, uint16 st } } -bool CinepakDecoder::canDither() const { - return _bitsPerPixel == 24; +bool CinepakDecoder::canDither(DitherType type) const { + return type == kDitherTypeVFW && _bitsPerPixel == 24; } -void CinepakDecoder::setDither(const byte *palette) { - assert(canDither()); +void CinepakDecoder::setDither(DitherType type, const byte *palette) { + assert(canDither(type)); delete[] _colorMap; delete[] _ditherPalette; diff --git a/image/codecs/cinepak.h b/image/codecs/cinepak.h index ce8451bf9a..ccdad0877c 100644 --- a/image/codecs/cinepak.h +++ b/image/codecs/cinepak.h @@ -75,8 +75,8 @@ public: bool containsPalette() const { return _ditherPalette != 0; } const byte *getPalette() { _dirtyPalette = false; return _ditherPalette; } bool hasDirtyPalette() const { return _dirtyPalette; } - bool canDither() const; - void setDither(const byte *palette); + bool canDither(DitherType type) const; + void setDither(DitherType type, const byte *palette); private: CinepakFrame _curFrame; diff --git a/image/codecs/codec.h b/image/codecs/codec.h index 3a2da9ff1e..9abbb3d183 100644 --- a/image/codecs/codec.h +++ b/image/codecs/codec.h @@ -59,6 +59,17 @@ public: virtual ~Codec() {} /** + * A type of dithering. + */ + enum DitherType { + /** Video for Windows dithering */ + kDitherTypeVFW, + + /** QuickTime dithering */ + kDitherTypeQT + }; + + /** * Decode the frame for the given data and return a pointer to a surface * containing the decoded frame. * @@ -89,17 +100,13 @@ public: /** * Can the codec dither down to 8bpp? - * - * @note This should only be used for VFW codecs */ - virtual bool canDither() const { return false; } + virtual bool canDither(DitherType type) const { return false; } /** * Activate dithering mode with a palette - * - * @note This should only be used for VFW codecs */ - virtual void setDither(const byte *palette) {} + virtual void setDither(DitherType type, const byte *palette) {} }; /** |