VirtualListView - add a UseCustomBackground flag true by default, if set to false it will bypass custom background drawing logic resulting in that speedboost I keep doing checkins for. Refactor RamWatch to check if there is any need to draw ahead of time and set this flag. Most of the time this will result is a good speed boost for this dialog, only if they are watching a frozen address (which isn't very exciting anyway) or an out of range address (which they need to fix) do they suffer the speed cost of background drawing

This commit is contained in:
adelikat 2014-07-30 21:31:13 +00:00
parent 555370540a
commit 2fd1ffe824
3 changed files with 34 additions and 1 deletions

View File

@ -202,6 +202,14 @@ namespace BizHawk.Client.Common
public void ClearChangeCount() { _changecount = 0; }
public bool IsOutOfRange
{
get
{
return !IsSeparator && Address.Value >= Domain.Size;
}
}
public string Notes { get { return _notes; } set { _notes = value; } }
public static Watch GenerateWatch(MemoryDomain domain, int address, WatchSize size, DisplayType type, string notes, bool bigEndian)

View File

@ -434,6 +434,8 @@ namespace BizHawk.Client.EmuHawk
View = View.Details;
Sorting = SortOrder.None;
UseCustomBackground = true;
ptrlvhti = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(LvHitTestInfo)));
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
@ -625,7 +627,7 @@ namespace BizHawk.Client.EmuHawk
OnCustomDrawNotice(ref m);
messageProcessed = true;
if (QueryItemBkColor == null)
if (QueryItemBkColor == null || !UseCustomBackground)
{
m.Result = (IntPtr)0;
}
@ -674,6 +676,7 @@ namespace BizHawk.Client.EmuHawk
}
public bool BlazingFast { get; set; }
public bool UseCustomBackground { get; set; }
protected ListViewItem GetItem(int idx)
{

View File

@ -237,11 +237,33 @@ namespace BizHawk.Client.EmuHawk
}
WatchListView.BlazingFast = true;
WatchListView.UseCustomBackground = NeedsBackground;
WatchListView.ItemCount = _watches.Count;
WatchListView.BlazingFast = false;
}
}
private bool NeedsBackground
{
get
{
foreach(var watch in _watches)
{
if (Global.CheatList.IsActive(_watches.Domain, watch.Address ?? 0))
{
return true;
}
if (watch.IsOutOfRange)
{
return true;
}
}
return false;
}
}
public void FastUpdate()
{
if (_paused)