mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
Fix resizing of the internal color array in Palette-class.
svn-id: r35136
This commit is contained in:
parent
16bf8d720b
commit
325b4cb492
@ -223,7 +223,7 @@ void Palette::saturatedAddColor(byte index, signed r, signed g, signed b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Palette& Palette::load9BitColors(uint16 *colors, uint colorCount) {
|
Palette& Palette::load9BitColors(uint16 *colors, uint colorCount) {
|
||||||
_colors.resize(colorCount);
|
setColorCount(colorCount);
|
||||||
for (uint i = 0; i < colorCount; i++) {
|
for (uint i = 0; i < colorCount; i++) {
|
||||||
setComponent(i, R_INDEX, ((colors[i] >> 8) & 7) * COMPONENT_MUL);
|
setComponent(i, R_INDEX, ((colors[i] >> 8) & 7) * COMPONENT_MUL);
|
||||||
setComponent(i, G_INDEX, ((colors[i] >> 4) & 7) * COMPONENT_MUL);
|
setComponent(i, G_INDEX, ((colors[i] >> 4) & 7) * COMPONENT_MUL);
|
||||||
@ -234,7 +234,7 @@ Palette& Palette::load9BitColors(uint16 *colors, uint colorCount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Palette& Palette::load24BitColors(byte *colors, uint colorCount) {
|
Palette& Palette::load24BitColors(byte *colors, uint colorCount) {
|
||||||
_colors.resize(colorCount);
|
setColorCount(colorCount);
|
||||||
for (uint i = 0; i < colorCount; i++) {
|
for (uint i = 0; i < colorCount; i++) {
|
||||||
setComponent(i, R_INDEX, colors[i * 3 + 0]);
|
setComponent(i, R_INDEX, colors[i * 3 + 0]);
|
||||||
setComponent(i, G_INDEX, colors[i * 3 + 1]);
|
setComponent(i, G_INDEX, colors[i * 3 + 1]);
|
||||||
@ -244,4 +244,8 @@ Palette& Palette::load24BitColors(byte *colors, uint colorCount) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Palette::setColorCount(uint colorCount) {
|
||||||
|
_colors.resize(colorCount * COMPONENTS_PER_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Cine
|
} // End of namespace Cine
|
||||||
|
@ -80,6 +80,7 @@ private:
|
|||||||
PackedColor getColor(byte colorIndex);
|
PackedColor getColor(byte colorIndex);
|
||||||
void setColor(byte colorIndex, PackedColor color);
|
void setColor(byte colorIndex, PackedColor color);
|
||||||
void saturatedAddColor(byte index, signed r, signed g, signed b);
|
void saturatedAddColor(byte index, signed r, signed g, signed b);
|
||||||
|
void setColorCount(uint colorCount);
|
||||||
|
|
||||||
Common::Array<byte> _colors;
|
Common::Array<byte> _colors;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user