(AbmReader): derive from BinaryImageDecoder.

This commit is contained in:
morkt
2016-12-25 07:15:54 +04:00
parent 86560c0444
commit 7a9a6a607f

View File

@@ -142,34 +142,20 @@ namespace GameRes.Formats.Lilim
} }
} }
internal sealed class AbmReader : IImageDecoder internal sealed class AbmReader : BinaryImageDecoder
{ {
IBinaryStream m_input;
byte[] m_output; byte[] m_output;
AbmImageData m_info; AbmImageData m_info;
ImageData m_image;
int m_bpp; int m_bpp;
public Stream Source { get { return m_input.AsStream; } } public AbmReader (IBinaryStream file, AbmImageData info) : base (file)
public ImageFormat SourceFormat { get { return null; } }
public ImageMetaData Info { get { return m_info; } }
public ImageData Image
{
get
{
if (null == m_image)
m_image = ReadImage();
return m_image;
}
}
public AbmReader (IBinaryStream file, AbmImageData info)
{ {
m_info = info; m_info = info;
m_input = file; m_input = file;
Info = m_info;
} }
ImageData ReadImage () protected override ImageData GetImageData ()
{ {
if (2 == m_info.Mode) if (2 == m_info.Mode)
{ {
@@ -335,18 +321,5 @@ namespace GameRes.Formats.Lilim
src += frame_w * pixel_size; src += frame_w * pixel_size;
} }
} }
#region IDisposable Members
bool m_disposed = false;
public void Dispose ()
{
if (!m_disposed)
{
m_input.Dispose();
m_disposed = true;
}
GC.SuppressFinalize (this);
}
#endregion
} }
} }