IMAGE: Allow for choosing dither type
This commit is contained in:
parent
ad32fb5832
commit
f342d63431
4 changed files with 21 additions and 14 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -58,6 +58,17 @@ public:
|
|||
Codec() {}
|
||||
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) {}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -831,12 +831,12 @@ bool AVIDecoder::AVIVideoTrack::hasDirtyPalette() const {
|
|||
}
|
||||
|
||||
bool AVIDecoder::AVIVideoTrack::canDither() const {
|
||||
return _videoCodec && _videoCodec->canDither();
|
||||
return _videoCodec && _videoCodec->canDither(Image::Codec::kDitherTypeVFW);
|
||||
}
|
||||
|
||||
void AVIDecoder::AVIVideoTrack::setDither(const byte *palette) {
|
||||
assert(_videoCodec);
|
||||
_videoCodec->setDither(palette);
|
||||
_videoCodec->setDither(Image::Codec::kDitherTypeVFW, palette);
|
||||
}
|
||||
|
||||
AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue