mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-30 03:26:12 -05:00
Fix/match MxBitmap::SetBitDepth
This commit is contained in:
parent
77755570f2
commit
a25bcecf47
1 changed files with 27 additions and 22 deletions
|
@ -296,36 +296,41 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor)
|
||||||
if (m_isHighColor == p_isHighColor) {
|
if (m_isHighColor == p_isHighColor) {
|
||||||
// no change: do nothing.
|
// no change: do nothing.
|
||||||
ret = SUCCESS;
|
ret = SUCCESS;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
switch (p_isHighColor) {
|
|
||||||
case FALSE:
|
|
||||||
ImportColorsToPalette(m_paletteData, m_palette);
|
|
||||||
if (m_palette)
|
|
||||||
delete m_palette;
|
|
||||||
|
|
||||||
m_palette = NULL;
|
switch (p_isHighColor) {
|
||||||
break;
|
case FALSE:
|
||||||
|
ImportColorsToPalette(m_paletteData, m_palette);
|
||||||
|
if (m_palette)
|
||||||
|
delete m_palette;
|
||||||
|
|
||||||
case TRUE:
|
m_palette = NULL;
|
||||||
pal = NULL;
|
break;
|
||||||
pal = new MxPalette(m_paletteData);
|
case TRUE: {
|
||||||
if (pal) {
|
pal = NULL;
|
||||||
m_palette = pal;
|
pal = new MxPalette(m_paletteData);
|
||||||
|
|
||||||
// TODO: what is this? zeroing out top half of palette?
|
if (!pal)
|
||||||
MxU16* buf = (MxU16*) m_paletteData;
|
goto done;
|
||||||
for (MxU16 i = 0; i < 256; i++) {
|
|
||||||
buf[i] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_isHighColor = p_isHighColor;
|
m_palette = pal;
|
||||||
ret = SUCCESS;
|
|
||||||
}
|
// TODO: what is this? zeroing out top half of palette?
|
||||||
break;
|
MxU16* buf = (MxU16*) m_paletteData;
|
||||||
|
for (MxU16 i = 0; i < 256; i++) {
|
||||||
|
buf[i] = i;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_isHighColor = p_isHighColor;
|
||||||
|
ret = SUCCESS;
|
||||||
|
|
||||||
|
done:
|
||||||
// If we were unsuccessful overall but did manage to alloc
|
// If we were unsuccessful overall but did manage to alloc
|
||||||
// the MxPalette, free it.
|
// the MxPalette, free it.
|
||||||
if (ret && pal)
|
if (ret && pal)
|
||||||
|
|
Loading…
Reference in a new issue