fix a crash when working on an 0x0 BitmapBuffer
This commit is contained in:
parent
f1bd6f0086
commit
257c8c597b
|
@ -476,17 +476,20 @@ namespace BizHawk.Bizware.BizwareGL
|
||||||
{
|
{
|
||||||
var bmpdata = bmp.LockBits(new sd.Rectangle(0, 0, Width, Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
var bmpdata = bmp.LockBits(new sd.Rectangle(0, 0, Width, Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||||
|
|
||||||
int* ptr = (int*)bmpdata.Scan0.ToPointer();
|
if (bmp.Width != 0 && bmp.Height != 0)
|
||||||
int stride = bmpdata.Stride;
|
|
||||||
fixed (int* pPtr = &Pixels[0])
|
|
||||||
{
|
{
|
||||||
for (int idx = 0, y = 0; y < Height; y++)
|
int* ptr = (int*)bmpdata.Scan0.ToPointer();
|
||||||
for (int x = 0; x < Width; x++)
|
int stride = bmpdata.Stride;
|
||||||
{
|
fixed (int* pPtr = &Pixels[0])
|
||||||
int srcPixel = pPtr[idx];
|
{
|
||||||
ptr[idx] = srcPixel;
|
for (int idx = 0, y = 0; y < Height; y++)
|
||||||
idx++;
|
for (int x = 0; x < Width; x++)
|
||||||
}
|
{
|
||||||
|
int srcPixel = pPtr[idx];
|
||||||
|
ptr[idx] = srcPixel;
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bmp.UnlockBits(bmpdata);
|
bmp.UnlockBits(bmpdata);
|
||||||
|
|
Loading…
Reference in New Issue