mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-25 05:34:27 +00:00
Fix for warnings on trunk-lenny-x86_64-build (Yay \o/ Buildbot!).
svn-id: r39456
This commit is contained in:
parent
52726344b7
commit
6e3bf6af79
@ -170,12 +170,12 @@ byte shiftByteLeft(const byte value, const signed shiftLeft) {
|
||||
}
|
||||
|
||||
/*! \brief Is given endian type big endian? (Handles native endian type too, otherwise this would be trivial). */
|
||||
bool isBigEndian(const EndianType endianType) {
|
||||
assert(endianType == CINE_NATIVE_ENDIAN || endianType == CINE_LITTLE_ENDIAN || endianType == CINE_BIG_ENDIAN);
|
||||
bool isBigEndian(const EndianType endian) {
|
||||
assert(endian == CINE_NATIVE_ENDIAN || endian == CINE_LITTLE_ENDIAN || endian == CINE_BIG_ENDIAN);
|
||||
|
||||
// Handle explicit little and big endian types here
|
||||
if (endianType != CINE_NATIVE_ENDIAN) {
|
||||
return (endianType == CINE_BIG_ENDIAN);
|
||||
if (endian != CINE_NATIVE_ENDIAN) {
|
||||
return (endian == CINE_BIG_ENDIAN);
|
||||
}
|
||||
|
||||
// Handle native endian type here
|
||||
@ -211,7 +211,7 @@ uint Palette::colorCount() const {
|
||||
return _colors.size();
|
||||
}
|
||||
|
||||
const EndianType Palette::endianType() const {
|
||||
EndianType Palette::endianType() const {
|
||||
return (_bigEndian ? CINE_BIG_ENDIAN : CINE_LITTLE_ENDIAN);
|
||||
}
|
||||
|
||||
@ -231,8 +231,8 @@ void Palette::setColorFormat(const Graphics::PixelFormat format) {
|
||||
_bMax = (1 << _bBits) - 1;
|
||||
}
|
||||
|
||||
void Palette::setEndianType(const EndianType endianType) {
|
||||
_bigEndian = isBigEndian(endianType);
|
||||
void Palette::setEndianType(const EndianType endian) {
|
||||
_bigEndian = isBigEndian(endian);
|
||||
}
|
||||
|
||||
// a.k.a. transformPaletteRange
|
||||
@ -259,22 +259,22 @@ Cine::Palette::Color Palette::saturatedAddColor(Cine::Palette::Color baseColor,
|
||||
return result;
|
||||
}
|
||||
|
||||
Palette &Palette::load(const byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endianType) {
|
||||
Palette &Palette::load(const byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endian) {
|
||||
assert(format.bytesPerPixel * numColors <= size); // Make sure there's enough input space
|
||||
assert(format.aLoss == 8); // No alpha
|
||||
assert(format.rShift / 8 == (format.rShift + MAX<int>(0, 8 - format.rLoss - 1)) / 8); // R must be inside one byte
|
||||
assert(format.gShift / 8 == (format.gShift + MAX<int>(0, 8 - format.gLoss - 1)) / 8); // G must be inside one byte
|
||||
assert(format.bShift / 8 == (format.bShift + MAX<int>(0, 8 - format.bLoss - 1)) / 8); // B must be inside one byte
|
||||
|
||||
setEndianType(endianType);
|
||||
setEndianType(endian);
|
||||
setColorFormat(format);
|
||||
|
||||
_colors.clear();
|
||||
_colors.resize(numColors);
|
||||
|
||||
const int rBytePos = bytePos(format.rShift, format.bytesPerPixel, isBigEndian(endianType));
|
||||
const int gBytePos = bytePos(format.gShift, format.bytesPerPixel, isBigEndian(endianType));
|
||||
const int bBytePos = bytePos(format.bShift, format.bytesPerPixel, isBigEndian(endianType));
|
||||
const int rBytePos = bytePos(format.rShift, format.bytesPerPixel, isBigEndian(endian));
|
||||
const int gBytePos = bytePos(format.gShift, format.bytesPerPixel, isBigEndian(endian));
|
||||
const int bBytePos = bytePos(format.bShift, format.bytesPerPixel, isBigEndian(endian));
|
||||
|
||||
for (uint i = 0; i < numColors; i++) {
|
||||
// _rMax, _gMax, _bMax are also used as masks here
|
||||
@ -286,15 +286,15 @@ Palette &Palette::load(const byte *buf, const uint size, const Graphics::PixelFo
|
||||
return *this;
|
||||
}
|
||||
|
||||
byte *Palette::save(byte *buf, const uint size, const EndianType endianType) const {
|
||||
return save(buf, size, colorFormat(), colorCount(), endianType);
|
||||
byte *Palette::save(byte *buf, const uint size, const EndianType endian) const {
|
||||
return save(buf, size, colorFormat(), colorCount(), endian);
|
||||
}
|
||||
|
||||
byte *Palette::save(byte *buf, const uint size, const Graphics::PixelFormat format, const EndianType endianType) const {
|
||||
return save(buf, size, format, colorCount(), endianType);
|
||||
byte *Palette::save(byte *buf, const uint size, const Graphics::PixelFormat format, const EndianType endian) const {
|
||||
return save(buf, size, format, colorCount(), endian);
|
||||
}
|
||||
|
||||
byte *Palette::save(byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endianType, const byte firstIndex) const {
|
||||
byte *Palette::save(byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endian, const byte firstIndex) const {
|
||||
assert(format.bytesPerPixel * numColors <= size); // Make sure there's enough output space
|
||||
assert(format.aLoss == 8); // No alpha
|
||||
assert(format.rShift / 8 == (format.rShift + MAX<int>(0, 8 - format.rLoss - 1)) / 8); // R must be inside one byte
|
||||
@ -314,9 +314,9 @@ byte *Palette::save(byte *buf, const uint size, const Graphics::PixelFormat form
|
||||
const byte gMask = ((1 << (8 - format.gLoss)) - 1) << (format.gShift % 8);
|
||||
const byte bMask = ((1 << (8 - format.bLoss)) - 1) << (format.bShift % 8);
|
||||
|
||||
const int rBytePos = bytePos(format.rShift, format.bytesPerPixel, isBigEndian(endianType));
|
||||
const int gBytePos = bytePos(format.gShift, format.bytesPerPixel, isBigEndian(endianType));
|
||||
const int bBytePos = bytePos(format.bShift, format.bytesPerPixel, isBigEndian(endianType));
|
||||
const int rBytePos = bytePos(format.rShift, format.bytesPerPixel, isBigEndian(endian));
|
||||
const int gBytePos = bytePos(format.gShift, format.bytesPerPixel, isBigEndian(endian));
|
||||
const int bBytePos = bytePos(format.bShift, format.bytesPerPixel, isBigEndian(endian));
|
||||
|
||||
// Save the palette to the output in the specified format
|
||||
for (uint i = firstIndex; i < firstIndex + numColors; i++) {
|
||||
|
@ -85,34 +85,34 @@ public:
|
||||
* \param size Input buffer size in bytes
|
||||
* \param format Input color format
|
||||
* \param numColors Number of colors to load
|
||||
* \param endianType The endianness of the colors in the input buffer
|
||||
* \param endian The endianness of the colors in the input buffer
|
||||
*/
|
||||
Palette &load(const byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endianType);
|
||||
Palette &load(const byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endian);
|
||||
|
||||
/*! \brief Save the whole palette to buffer in original color format using defined endianness.
|
||||
* \param buf Output buffer
|
||||
* \param size Output buffer size in bytes
|
||||
* \param endianType The endian type to use
|
||||
* \param endian The endian type to use
|
||||
*/
|
||||
byte *save(byte *buf, const uint size, const EndianType endianType) const;
|
||||
byte *save(byte *buf, const uint size, const EndianType endian) const;
|
||||
|
||||
/*! \brief Save the whole palette to buffer in given color format using defined endianness.
|
||||
* \param buf Output buffer
|
||||
* \param size Output buffer size in bytes
|
||||
* \param format Output color format
|
||||
* \param endianType The endian type to use
|
||||
* \param endian The endian type to use
|
||||
*/
|
||||
byte *save(byte *buf, const uint size, const Graphics::PixelFormat format, const EndianType endianType) const;
|
||||
byte *save(byte *buf, const uint size, const Graphics::PixelFormat format, const EndianType endian) const;
|
||||
|
||||
/*! \brief Save (partial) palette to buffer in given color format using defined endianness.
|
||||
* \param buf Output buffer
|
||||
* \param size Output buffer size in bytes
|
||||
* \param format Output color format
|
||||
* \param numColors Number of colors to save
|
||||
* \param endianType The endian type to use
|
||||
* \param endian The endian type to use
|
||||
* \param firstIndex Starting color index (from which onwards to save the colors)
|
||||
*/
|
||||
byte *save(byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endianType, const byte firstIndex = 0) const;
|
||||
byte *save(byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const EndianType endian, const byte firstIndex = 0) const;
|
||||
|
||||
Palette &rotateRight(byte firstIndex, byte lastIndex);
|
||||
Palette &saturatedAddColor(Palette& output, byte firstIndex, byte lastIndex, signed r, signed g, signed b);
|
||||
@ -121,14 +121,14 @@ public:
|
||||
/*! \brief The original endian type in which this palette was loaded.
|
||||
* \note This will always return either CINE_BIG_ENDIAN or CINE_LITTLE_ENDIAN (So no CINE_NATIVE_ENDIAN).
|
||||
*/
|
||||
const EndianType endianType() const;
|
||||
EndianType endianType() const;
|
||||
|
||||
/*! \brief The original color format in which this palette was loaded. */
|
||||
Graphics::PixelFormat colorFormat() const;
|
||||
|
||||
private:
|
||||
void setColorFormat(const Graphics::PixelFormat format);
|
||||
void setEndianType(const EndianType endianType);
|
||||
void setEndianType(const EndianType endian);
|
||||
Cine::Palette::Color saturatedAddColor(Cine::Palette::Color baseColor, signed r, signed g, signed b) const;
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user