Replace Win32 call from Bmp and Gb view

This commit is contained in:
alyosha-tas 2021-07-29 17:12:25 -04:00
parent 6ba3bfa1a2
commit 3c257d48ba
2 changed files with 5 additions and 6 deletions

View File

@ -6,8 +6,6 @@ using System.Drawing.Imaging;
using System.Drawing;
using System.Windows.Forms;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
public class BmpView : Control
@ -89,10 +87,11 @@ namespace BizHawk.Client.EmuHawk
Refresh();
}
public void Clear()
public unsafe void Clear()
{
var lockBits = Bmp.LockBits(new Rectangle(0, 0, Bmp.Width, Bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
Win32Imports.MemSet(lockBits.Scan0, 0xff, (uint)(lockBits.Height * lockBits.Stride));
byte* clear_out = (byte*)lockBits.Scan0;
for (uint i = 0; i < (uint)(lockBits.Height * lockBits.Stride); i++) { clear_out[i] = 0xFF; }
Bmp.UnlockBits(lockBits);
Refresh();
}

View File

@ -8,7 +8,6 @@ using BizHawk.Client.Common;
using BizHawk.Common.NumberExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
@ -357,7 +356,8 @@ namespace BizHawk.Client.EmuHawk
byte* oam = (byte*)_oam;
// clear out the old sprite data
Win32Imports.MemSet(lockData.Scan0, 0xff, (uint)(lockData.Height * lockData.Stride));
byte* clear_out = (byte*)lockData.Scan0;
for (uint i = 0; i < (uint)(lockData.Height * lockData.Stride); i++) { clear_out[i] = 0xFF; }
for (int s = 0; s < 40; s++)
{