aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GraphicObject.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-06 07:48:57 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-06 07:48:57 +0100
commit9559ce33ebf536b8329a32c79e626f052349e157 (patch)
treee4169911ef1b7ea41e2a2c0cafcc89038a8c839c /src/GraphicObjects/GraphicObject.cs
parentbf2a27565631b8eaf29fd781befce937c59b43e3 (diff)
remove linq search from deleteLQIs
Diffstat (limited to 'src/GraphicObjects/GraphicObject.cs')
-rw-r--r--src/GraphicObjects/GraphicObject.cs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs
index 6f565340..f6963cb5 100644
--- a/src/GraphicObjects/GraphicObject.cs
+++ b/src/GraphicObjects/GraphicObject.cs
@@ -111,7 +111,10 @@ namespace Crow
#endregion
#region ILayoutable
-
+ /// <summary>
+ /// Keep ref's of LQI in queue per GraphicObject, to prevent searching in
+ /// the double linked list which would be very slow.
+ /// </summary>
public List<LinkedListNode<LayoutingQueueItem>> RegisteredLQINodes { get; } = new List<LinkedListNode<LayoutingQueueItem>>();
//TODO: it would save the recurent cost of a cast in event bubbling if parent type was GraphicObject
// or we could add to the interface the mouse events
@@ -501,12 +504,17 @@ namespace Crow
protected virtual Size measureRawSize () {
return Bounds.Size;
}
-
+ /// <summary>
+ /// Delete all ref's to this LQI (local and inQueue)
+ /// </summary>
void deleteLQI(int lt){
- LinkedListNode<LayoutingQueueItem>[] lqis = this.RegisteredLQINodes.Where (n => (lt & (int)n.Value.LayoutType) > 0).ToArray ();
- for (int i = 0; i < lqis.Length; i++) {
- Interface.LayoutingQueue.Remove (lqis [i]);
- RegisteredLQINodes.Remove (lqis [i]);
+ int i = 0;
+ while (i < RegisteredLQINodes.Count) {
+ if (((int)RegisteredLQINodes [i].Value.LayoutType & lt) > 0) {
+ Interface.LayoutingQueue.Remove (RegisteredLQINodes [i]);
+ RegisteredLQINodes.RemoveAt (i);
+ } else
+ i++;
}
}
/// <summary> clear current layoutingQueue items for object and