Change `SNESGraphicsDebugger.RenderPalette` to re-use one `SolidBrush`

This commit is contained in:
YoshiRulz 2024-09-26 08:41:31 +10:00 committed by James Groom
parent 0313e1c119
commit 1b1589f2e8
1 changed files with 2 additions and 2 deletions

View File

@ -669,13 +669,13 @@ namespace BizHawk.Client.EmuHawk
var bmp = new Bitmap(pixsize, pixsize, PixelFormat.Format32bppArgb); var bmp = new Bitmap(pixsize, pixsize, PixelFormat.Format32bppArgb);
using (var g = Graphics.FromImage(bmp)) using (var g = Graphics.FromImage(bmp))
{ {
using SolidBrush brush = new(default);
for (int y = 0; y < 16; y++) for (int y = 0; y < 16; y++)
{ {
for (int x = 0; x < 16; x++) for (int x = 0; x < 16; x++)
{ {
int rgb555 = lastPalette[y * 16 + x]; int rgb555 = lastPalette[y * 16 + x];
int color = gd.Colorize(rgb555); brush.Color = Color.FromArgb(gd.Colorize(rgb555));
using var brush = new SolidBrush(Color.FromArgb(color));
g.FillRectangle(brush, new Rectangle(paletteCellSpacing + x * cellTotalSize, paletteCellSpacing + y * cellTotalSize, paletteCellSize, paletteCellSize)); g.FillRectangle(brush, new Rectangle(paletteCellSpacing + x * cellTotalSize, paletteCellSpacing + y * cellTotalSize, paletteCellSize, paletteCellSize));
} }
} }