pinvoking enums is safe and fun

This commit is contained in:
goyuken 2014-08-18 06:50:12 +00:00
parent 7afabc4a06
commit a1df2f1cd0
1 changed files with 5 additions and 5 deletions

View File

@ -39,7 +39,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
public GDIRenderer() public GDIRenderer()
{ {
SetBkMode(_hdc, (int)BkModes.OPAQUE); SetBkMode(_hdc, BkModes.OPAQUE);
} }
public void Dispose() public void Dispose()
@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
{ {
_g = g; _g = g;
_hdc = g.GetHdc(); _hdc = g.GetHdc();
SetBkMode(_hdc, (int)BkModes.TRANSPARENT); SetBkMode(_hdc, BkModes.TRANSPARENT);
return new GdiGraphicsLock(this); return new GdiGraphicsLock(this);
} }
@ -207,7 +207,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
_bitHDC = CreateCompatibleDC(_hdc); _bitHDC = CreateCompatibleDC(_hdc);
_bitMap = CreateCompatibleBitmap(_hdc, width, height); _bitMap = CreateCompatibleBitmap(_hdc, width, height);
SelectObject(_bitHDC, _bitMap); SelectObject(_bitHDC, _bitMap);
SetBkMode(_bitHDC, (int)BkModes.TRANSPARENT); SetBkMode(_bitHDC, BkModes.TRANSPARENT);
} }
public void EndOffScreenBitmap() public void EndOffScreenBitmap()
@ -292,7 +292,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
private static extern int FillRect(IntPtr hdc, [In] ref GDIRect lprc, IntPtr hbr); private static extern int FillRect(IntPtr hdc, [In] ref GDIRect lprc, IntPtr hbr);
[DllImport("gdi32.dll")] [DllImport("gdi32.dll")]
private static extern int SetBkMode(IntPtr hdc, int mode); private static extern int SetBkMode(IntPtr hdc, BkModes mode);
[DllImport("gdi32.dll")] [DllImport("gdi32.dll")]
private static extern int SelectObject(IntPtr hdc, IntPtr hgdiObj); private static extern int SelectObject(IntPtr hdc, IntPtr hgdiObj);
@ -474,7 +474,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
DC_PEN = 19, DC_PEN = 19,
} }
public enum BkModes public enum BkModes : int
{ {
TRANSPARENT = 1, TRANSPARENT = 1,
OPAQUE = 2 OPAQUE = 2