mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-25 12:24:12 +08:00
(DwqBmpReader): fixed indexed images reading.
This commit is contained in:
parent
2b19069f7c
commit
3f900739f9
@ -124,9 +124,7 @@ namespace GameRes.Formats.BlackCyc
|
|||||||
|
|
||||||
public override ImageData Read (Stream stream, ImageMetaData info)
|
public override ImageData Read (Stream stream, ImageMetaData info)
|
||||||
{
|
{
|
||||||
var meta = info as DwqMetaData;
|
var meta = (DwqMetaData)info;
|
||||||
if (null == meta)
|
|
||||||
throw new ArgumentException ("DwqFormat.Read should be supplied with DwqMetaData", "info");
|
|
||||||
|
|
||||||
BitmapSource bitmap = null;
|
BitmapSource bitmap = null;
|
||||||
using (var input = new StreamRegion (stream, 0x40, meta.PackedSize, true))
|
using (var input = new StreamRegion (stream, 0x40, meta.PackedSize, true))
|
||||||
@ -298,6 +296,8 @@ namespace GameRes.Formats.BlackCyc
|
|||||||
if (8 == bpp)
|
if (8 == bpp)
|
||||||
{
|
{
|
||||||
int colors = Math.Min (LittleEndian.ToInt32 (header, 0x2E), 0x100);
|
int colors = Math.Min (LittleEndian.ToInt32 (header, 0x2E), 0x100);
|
||||||
|
if (0 == colors)
|
||||||
|
colors = 0x100;
|
||||||
Palette = ReadPalette (m_input, colors);
|
Palette = ReadPalette (m_input, colors);
|
||||||
}
|
}
|
||||||
uint data_position = LittleEndian.ToUInt32 (header, 0xA);
|
uint data_position = LittleEndian.ToUInt32 (header, 0xA);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user