mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 04:28:37 +00:00
Add saving in original palette format and the OSystem's palette format to Cine::Palette.
svn-id: r39337
This commit is contained in:
parent
4cbd3678f8
commit
c676786146
@ -25,12 +25,13 @@
|
||||
|
||||
#include "cine/cine.h"
|
||||
#include "cine/various.h"
|
||||
#include "graphics/pixelformat.h"
|
||||
#include "cine/pal.h"
|
||||
|
||||
namespace Cine {
|
||||
|
||||
static const Graphics::PixelFormat kLowPalFormat = {2, 5, 5, 5, 8, 8, 4, 0, 0};
|
||||
static const Graphics::PixelFormat kHighPalFormat = {3, 0, 0, 0, 8, 0, 8, 16, 0};
|
||||
static const Graphics::PixelFormat kSystemPalFormat = {4, 0, 0, 0, 8, 0, 8, 16, 0};
|
||||
|
||||
Common::Array<PalEntry> palArray;
|
||||
static byte paletteBuffer1[16];
|
||||
@ -179,6 +180,10 @@ uint Palette::colorCount() const {
|
||||
return _colors.size();
|
||||
}
|
||||
|
||||
Graphics::PixelFormat Palette::colorFormat() const {
|
||||
return _format;
|
||||
}
|
||||
|
||||
// a.k.a. transformPaletteRange
|
||||
Palette &Palette::saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b) {
|
||||
assert(firstIndex < colorCount() && lastIndex < colorCount());
|
||||
@ -212,6 +217,8 @@ Palette &Palette::load(const byte *colors, const Graphics::PixelFormat format, c
|
||||
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
|
||||
|
||||
_format = format;
|
||||
|
||||
_rBits = (8 - format.rLoss);
|
||||
_gBits = (8 - format.gLoss);
|
||||
_bBits = (8 - format.bLoss);
|
||||
@ -262,4 +269,14 @@ byte *Palette::saveCineHighPal(byte *colors, const uint numBytes) const
|
||||
return save(colors, numBytes, kHighPalFormat);
|
||||
}
|
||||
|
||||
byte *Palette::saveOrigFormat(byte *colors, const uint numBytes) const
|
||||
{
|
||||
return save(colors, numBytes, colorFormat());
|
||||
}
|
||||
|
||||
byte *Palette::saveSystemFormat(byte *colors, const uint numBytes) const
|
||||
{
|
||||
return save(colors, numBytes, kSystemPalFormat);
|
||||
}
|
||||
|
||||
} // End of namespace Cine
|
||||
|
@ -26,10 +26,7 @@
|
||||
#ifndef CINE_PAL_H
|
||||
#define CINE_PAL_H
|
||||
|
||||
// Forward declare Graphics::PixelFormat so we don't have to include its header here
|
||||
namespace Graphics {
|
||||
struct PixelFormat;
|
||||
}
|
||||
#include "graphics/pixelformat.h"
|
||||
|
||||
namespace Cine {
|
||||
|
||||
@ -63,11 +60,14 @@ public:
|
||||
|
||||
byte *saveCineLowPal(byte *colors, const uint numBytes) const;
|
||||
byte *saveCineHighPal(byte *colors, const uint numBytes) const;
|
||||
byte *saveOrigFormat(byte *colors, const uint numBytes) const;
|
||||
byte *saveSystemFormat(byte *colors, const uint numBytes) const;
|
||||
byte *save(byte *colors, const uint numBytes, const Graphics::PixelFormat format) const;
|
||||
|
||||
Palette &rotateRight(byte firstIndex, byte lastIndex);
|
||||
Palette &saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b);
|
||||
uint colorCount() const;
|
||||
Graphics::PixelFormat colorFormat() const;
|
||||
|
||||
private:
|
||||
void saturatedAddColor(byte index, signed r, signed g, signed b);
|
||||
@ -77,6 +77,7 @@ private:
|
||||
uint8 r, g, b;
|
||||
};
|
||||
|
||||
Graphics::PixelFormat _format;
|
||||
uint _rBits, _gBits, _bBits;
|
||||
uint _rMax, _gMax, _bMax;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user