From 772bd5b65eff75f4cb9683c5925f664605c60cc0 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 26 Oct 2019 15:22:47 -0500 Subject: [PATCH] Remove blend option in IControlRenderer, true was always being passed for GDI, so just always do alpha blend in GDI --- .../CustomControls/ControlRenderer/GDIRenderer.cs | 11 ++--------- .../CustomControls/ControlRenderer/GdiPlusRenderer.cs | 3 +-- .../ControlRenderer/IControlRenderer.cs | 2 +- .../CustomControls/InputRoll.Drawing.cs | 4 ++-- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GDIRenderer.cs b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GDIRenderer.cs index 679b8b3b53..12e76de025 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GDIRenderer.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GDIRenderer.cs @@ -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); diff --git a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GdiPlusRenderer.cs b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GdiPlusRenderer.cs index ef23e7b98a..49032aa3c9 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GdiPlusRenderer.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/GdiPlusRenderer.cs @@ -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); } diff --git a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/IControlRenderer.cs b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/IControlRenderer.cs index a0d222c0ef..b5a481cd2c 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/IControlRenderer.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/ControlRenderer/IControlRenderer.cs @@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls /// /// Draw a bitmap object at the given position /// - 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); } } diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll.Drawing.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll.Drawing.cs index 24ce6d181d..f130084254 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll.Drawing.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll.Drawing.cs @@ -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);