Remove blend option in IControlRenderer, true was always being passed for GDI, so just always do alpha blend in GDI

This commit is contained in:
adelikat 2019-10-26 15:22:47 -05:00
parent 4d576ea9da
commit 772bd5b65e
4 changed files with 6 additions and 14 deletions

View File

@ -53,19 +53,12 @@ namespace BizHawk.Client.EmuHawk.CustomControls
#region Api
public void DrawBitmap(Bitmap bitmap, Point point, bool blend = false)
public void DrawBitmap(Bitmap bitmap, Point point)
{
IntPtr hBmp = bitmap.GetHbitmap();
var bitHdc = CreateCompatibleDC(CurrentHdc);
IntPtr old = SelectObject(bitHdc, hBmp);
if (blend)
{
AlphaBlend(CurrentHdc, point.X, point.Y, bitmap.Width, bitmap.Height, bitHdc, 0, 0, bitmap.Width, bitmap.Height, new BLENDFUNCTION(AC_SRC_OVER, 0, 0xff, AC_SRC_ALPHA));
}
else
{
BitBlt(CurrentHdc, point.X, point.Y, bitmap.Width, bitmap.Height, bitHdc, 0, 0, 0xCC0020);
}
AlphaBlend(CurrentHdc, point.X, point.Y, bitmap.Width, bitmap.Height, bitHdc, 0, 0, bitmap.Width, bitmap.Height, new BLENDFUNCTION(AC_SRC_OVER, 0, 0xff, AC_SRC_ALPHA));
SelectObject(bitHdc, old);
DeleteDC(bitHdc);
DeleteObject(hBmp);

View File

@ -36,9 +36,8 @@ namespace BizHawk.Client.EmuHawk.CustomControls
_defaultFont.Dispose();
}
public void DrawBitmap(Bitmap bitmap, Point point, bool blend = false)
public void DrawBitmap(Bitmap bitmap, Point point)
{
// TODO: implement blend
_graphics.DrawImage(bitmap, point);
}

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls
/// <summary>
/// Draw a bitmap object at the given position
/// </summary>
void DrawBitmap(Bitmap bitmap, Point point, bool blend = false);
void DrawBitmap(Bitmap bitmap, Point point);
void Line(int x1, int y1, int x2, int y2);
}
}

View File

@ -185,7 +185,7 @@ namespace BizHawk.Client.EmuHawk
{
x = RowsToPixels(i) + CellWidthPadding + bitmapOffsetX;
y = (j * CellHeight) + (CellHeightPadding * 2) + bitmapOffsetY;
_renderer.DrawBitmap(image, new Point(x, y), true);
_renderer.DrawBitmap(image, new Point(x, y));
}
string text;
@ -249,7 +249,7 @@ namespace BizHawk.Client.EmuHawk
if (image != null)
{
_renderer.DrawBitmap(image, new Point(point.X + bitmapOffsetX, point.Y + bitmapOffsetY + CellHeightPadding), true);
_renderer.DrawBitmap(image, new Point(point.X + bitmapOffsetX, point.Y + bitmapOffsetY + CellHeightPadding));
}
QueryItemText(f + startRow, visibleColumns[j], out text, ref strOffsetX, ref strOffsetY);