tasproj branch thumbnail: change load to simply load whatever size is present in the zip file.

This commit is contained in:
nattthebear 2015-07-22 18:02:38 -04:00
parent 72d73cd754
commit e43e89e5cc
2 changed files with 23 additions and 2 deletions

View File

@ -189,6 +189,20 @@ namespace BizHawk.Client.Common
}
}
/// <summary>
/// if passed to QuickBMPFile.Load(), will size itself to match the incoming bmp
/// </summary>
public class LoadedBMP : IVideoProvider
{
public int[] VideoBuffer { get; set; }
public int[] GetVideoBuffer() { return VideoBuffer; }
public int VirtualWidth { get { return BufferWidth; } }
public int VirtualHeight { get { return BufferHeight; } }
public int BufferWidth { get; set; }
public int BufferHeight { get; set; }
public int BackgroundColor { get { return unchecked((int)0xff000000); } }
}
public unsafe static bool Load(IVideoProvider v, Stream s)
{
var bf = BITMAPFILEHEADER.FromStream(s);
@ -204,6 +218,13 @@ namespace BizHawk.Client.Common
byte[] src = new byte[in_w * in_h * 4];
s.Read(src, 0, src.Length);
if (v is LoadedBMP)
{
var l = v as LoadedBMP;
l.BufferWidth = in_w;
l.BufferHeight = in_h;
l.VideoBuffer = new int[in_w * in_h];
}
int[] dst = v.GetVideoBuffer();
fixed (byte *srcp = src)

View File

@ -98,9 +98,9 @@ namespace BizHawk.Client.Common
bl.GetLump(nframebuffer, true, delegate(Stream s, long length)
{
b.OSDFrameBuffer = new BitmapBuffer(160, 120); // todo: choose size more smarterly
var vp = new BitmapBufferVideoProvider(b.OSDFrameBuffer);
var vp = new QuickBmpFile.LoadedBMP();
QuickBmpFile.Load(vp, s);
b.OSDFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.VideoBuffer);
});
bl.GetLump(nlaglog, true, delegate(BinaryReader br)