add a little fast path to BitmapBuffer. probably no real use

This commit is contained in:
zeromus 2014-12-17 01:07:09 +00:00
parent 665ead318b
commit 45716e8acf
1 changed files with 3 additions and 1 deletions

View File

@ -494,7 +494,9 @@ namespace BizHawk.Bizware.BizwareGL
//note: we lock it as 32bpp even if the bitmap is 24bpp so we can write to it more conveniently.
var bmpdata = bmp.LockBits(new sd.Rectangle(0, 0, Width, Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
if (bmp.Width != 0 && bmp.Height != 0)
if(bmpdata.Stride == bmpdata.Width*4)
Marshal.Copy(Pixels, 0, bmpdata.Scan0, Width * Height);
else if (bmp.Width != 0 && bmp.Height != 0)
{
int* ptr = (int*)bmpdata.Scan0.ToPointer();
int stride = bmpdata.Stride;