From ac96d4cc4af141a4b01bad2b09ca84f9d1564289 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 13 Jun 2012 02:18:34 +0000 Subject: [PATCH] Hex Editor - draw header only as needed rather than every frame, 1-2 fps speedup --- BizHawk.MultiClient/tools/HexEditor.Designer.cs | 15 ++++++++++++++- BizHawk.MultiClient/tools/HexEditor.cs | 12 +++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/BizHawk.MultiClient/tools/HexEditor.Designer.cs b/BizHawk.MultiClient/tools/HexEditor.Designer.cs index 94a0198069..7ea6a85925 100644 --- a/BizHawk.MultiClient/tools/HexEditor.Designer.cs +++ b/BizHawk.MultiClient/tools/HexEditor.Designer.cs @@ -77,6 +77,7 @@ this.MemoryViewerBox = new System.Windows.Forms.GroupBox(); this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); this.AddressesLabel = new System.Windows.Forms.Label(); + this.Header = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); this.ViewerContextMenuStrip.SuspendLayout(); this.MemoryViewerBox.SuspendLayout(); @@ -472,7 +473,7 @@ // this.AddressesLabel.AutoSize = true; this.AddressesLabel.ContextMenuStrip = this.ViewerContextMenuStrip; - this.AddressesLabel.Location = new System.Drawing.Point(6, 16); + this.AddressesLabel.Location = new System.Drawing.Point(6, 30); this.AddressesLabel.Name = "AddressesLabel"; this.AddressesLabel.Size = new System.Drawing.Size(31, 13); this.AddressesLabel.TabIndex = 0; @@ -481,11 +482,22 @@ this.AddressesLabel.MouseLeave += new System.EventHandler(this.AddressesLabel_MouseLeave); this.AddressesLabel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.AddressesLabel_MouseMove); // + // Header + // + this.Header.AutoSize = true; + this.Header.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Header.Location = new System.Drawing.Point(18, 44); + this.Header.Name = "Header"; + this.Header.Size = new System.Drawing.Size(35, 13); + this.Header.TabIndex = 2; + this.Header.Text = "label1"; + // // HexEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(584, 301); + this.Controls.Add(this.Header); this.Controls.Add(this.MemoryViewerBox); this.Controls.Add(this.menuStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -558,5 +570,6 @@ private System.Windows.Forms.ToolStripMenuItem setColorsToolStripMenuItem1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator8; private System.Windows.Forms.ToolStripMenuItem resetToDefaultToolStripMenuItem1; + private System.Windows.Forms.Label Header; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/HexEditor.cs b/BizHawk.MultiClient/tools/HexEditor.cs index f1d226ec44..a0536c5cc5 100644 --- a/BizHawk.MultiClient/tools/HexEditor.cs +++ b/BizHawk.MultiClient/tools/HexEditor.cs @@ -22,7 +22,6 @@ namespace BizHawk.MultiClient int defaultHeight; List domainMenuItems = new List(); int RowsVisible = 0; - string Header = ""; int NumDigits = 4; string NumDigitsStr = "{0:X4} "; string DigitFormatString = "{0:X2} "; @@ -62,7 +61,8 @@ namespace BizHawk.MultiClient LoadConfigSettings(); SetHeader(); Closing += (o, e) => SaveConfigSettings(); - AddressesLabel.Font = new Font("Courier New", 8); ; + Header.Font = new Font("Courier New", 8); + AddressesLabel.Font = new Font("Courier New", 8); } private void LoadConfigSettings() @@ -131,8 +131,6 @@ namespace BizHawk.MultiClient StringBuilder rowStr = new StringBuilder(""); addrOffset = (NumDigits % 4) * 9; - rowStr.Append(Header + '\n'); - for (int i = 0; i < RowsVisible; i++) { row = i + vScrollBar1.Value; @@ -434,13 +432,13 @@ namespace BizHawk.MultiClient switch (DataSize) { case 1: - Header = " 0 1 2 3 4 5 6 7 8 9 A B C D E F"; + Header.Text = " 0 1 2 3 4 5 6 7 8 9 A B C D E F"; break; case 2: - Header = " 0 2 4 6 8 A C E"; + Header.Text = " 0 2 4 6 8 A C E"; break; case 4: - Header = " 0 4 8 C"; + Header.Text = " 0 4 8 C"; break; } NumDigits = GetNumDigits(Domain.Size);