nes palette viewer - dont' new up brushes on every draw

This commit is contained in:
adelikat 2020-09-13 12:52:37 -05:00
parent 5c5438ea18
commit 284af73b14
1 changed files with 7 additions and 2 deletions

View File

@ -5,6 +5,9 @@ namespace BizHawk.Client.EmuHawk
{
public sealed class PaletteViewer : Control
{
private readonly SolidBrush BgPalettesBrush = new SolidBrush(Color.Black);
private readonly SolidBrush SpritePalettesBrush = new SolidBrush(Color.Black);
public class Palette
{
public int Address { get; }
@ -49,8 +52,10 @@ namespace BizHawk.Client.EmuHawk
{
for (int x = 0; x < 16; x++)
{
e.Graphics.FillRectangle(new SolidBrush(BgPalettes[x].Color), new Rectangle(x * 16, 0, 16, 16));
e.Graphics.FillRectangle(new SolidBrush(SpritePalettes[x].Color), new Rectangle(x * 16, 16, 16, 16));
BgPalettesBrush.Color = BgPalettes[x].Color;
SpritePalettesBrush.Color = SpritePalettes[x].Color;
e.Graphics.FillRectangle(BgPalettesBrush, new Rectangle(x * 16, 0, 16, 16));
e.Graphics.FillRectangle(SpritePalettesBrush, new Rectangle(x * 16, 16, 16, 16));
}
}