(GrdReader): use Bgr32 format for images with empty alpha-channel.

This commit is contained in:
morkt 2016-02-28 02:54:07 +04:00
parent 98ddd452fb
commit eba51cf69e

View File

@ -114,10 +114,12 @@ namespace GameRes.Formats.TmrHiro
{ {
m_input = input; m_input = input;
m_info = info; m_info = info;
if (32 == m_info.BPP) if (24 == m_info.BPP)
Format = PixelFormats.Bgr24;
else if (m_info.AlphaSize > 0)
Format = PixelFormats.Bgra32; Format = PixelFormats.Bgra32;
else else
Format = PixelFormats.Bgr24; Format = PixelFormats.Bgr32;
int channel_size = (int)(m_info.Width * m_info.Height); int channel_size = (int)(m_info.Width * m_info.Height);
m_pack_type = m_info.Format >> 8; m_pack_type = m_info.Format >> 8;
m_pixel_size = m_info.BPP / 8; m_pixel_size = m_info.BPP / 8;
@ -128,7 +130,7 @@ namespace GameRes.Formats.TmrHiro
public void Unpack () public void Unpack ()
{ {
int next_pos = 0x20; int next_pos = 0x20;
if (32 == m_info.BPP) if (32 == m_info.BPP && m_info.AlphaSize > 0)
{ {
UnpackChannel (3, next_pos, m_info.AlphaSize); UnpackChannel (3, next_pos, m_info.AlphaSize);
next_pos += m_info.AlphaSize; next_pos += m_info.AlphaSize;