mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-12 12:59:28 +08:00
(BMP): refined detection of bitmaps with alpha channel.
This commit is contained in:
parent
1922c42ae2
commit
5a858cf42d
@ -49,17 +49,20 @@ namespace GameRes
|
|||||||
public override ImageData Read (Stream file, ImageMetaData info)
|
public override ImageData Read (Stream file, ImageMetaData info)
|
||||||
{
|
{
|
||||||
var bmp_info = info as BmpMetaData;
|
var bmp_info = info as BmpMetaData;
|
||||||
if (bmp_info != null && file.CanSeek
|
if (bmp_info != null && file.CanSeek)
|
||||||
&& info.Width * info.Height * (uint)info.BPP/8 + bmp_info.HeaderLength == bmp_info.ImageLength)
|
|
||||||
{
|
{
|
||||||
if (0x20 == info.BPP)
|
uint bmp_length = info.Width * info.Height * (uint)info.BPP/8 + bmp_info.HeaderLength;
|
||||||
|
if (bmp_length == bmp_info.ImageLength || bmp_length+2 == bmp_info.ImageLength)
|
||||||
{
|
{
|
||||||
return ReadBitmapBGRA (file, bmp_info);
|
if (0x20 == info.BPP)
|
||||||
}
|
{
|
||||||
else if (0x18 == info.BPP
|
return ReadBitmapBGRA (file, bmp_info);
|
||||||
&& (bmp_info.ImageLength + info.Width * info.Height) == file.Length)
|
}
|
||||||
{
|
else if (0x18 == info.BPP
|
||||||
return ReadBitmapWithAlpha (file, bmp_info);
|
&& (bmp_info.ImageLength + info.Width * info.Height) == file.Length)
|
||||||
|
{
|
||||||
|
return ReadBitmapWithAlpha (file, bmp_info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var decoder = new BmpBitmapDecoder (file,
|
var decoder = new BmpBitmapDecoder (file,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user