diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-04 19:48:05 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-04 20:06:58 +0200 |
| commit | b58c6b328c06784d31765b29b574bed17082be27 (patch) | |
| tree | 03df05738a0d8d0f07db24f8768bdf321710f40a /src/Interface.cs | |
| parent | e2d351c9de4ee9c8b04376228f3ab5b9310392c9 (diff) | |
Layouting DiscardQueue with MaxDiscardCount
modifié : src/Interface.cs
modifié : src/LayoutingQueueItem.cs
modifié : src/GraphicObjects/ListBox.cs
Diffstat (limited to 'src/Interface.cs')
| -rw-r--r-- | src/Interface.cs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Interface.cs b/src/Interface.cs index 6d532164..ca5cb28f 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -81,7 +81,8 @@ namespace Crow public const int MaxCacheSize = 2048; /// <summary> Above this count, the layouting is discard for the widget and it /// will not be rendered on screen </summary> - public const int MaxLayoutingTries = 50; + public const int MaxLayoutingTries = 5; + public const int MaxDiscardCount = 10; /// <summary> Global font rendering settings for Cairo </summary> public static FontOptions FontRenderingOptions; #endregion @@ -89,6 +90,7 @@ namespace Crow internal bool XmlLoading = false; public Queue<LayoutingQueueItem> LayoutingQueue = new Queue<LayoutingQueueItem> (); + public Queue<LayoutingQueueItem> DiscardQueue; public Queue<LayoutingQueueItem> ProcessedLayoutingQueue; public Queue<GraphicObject> DrawingQueue = new Queue<GraphicObject>(); public string Clipboard;//TODO:use object instead for complex copy paste @@ -96,6 +98,12 @@ namespace Crow { // if (g.RegisteredLayoutings != LayoutingType.None) // return; + ILayoutable l = g; + while (l.Parent != null) + l = l.Parent; + if (!(l is Interface)) + return; + lock (DrawingQueue) { if (g.IsQueueForRedraw) return; @@ -400,14 +408,17 @@ namespace Crow #if MEASURE_TIME layoutTime.Restart(); #endif + DiscardQueue = new Queue<LayoutingQueueItem> (); lock (LayoutMutex) { //Debug.WriteLine ("======= Layouting queue start ======="); LayoutingQueueItem lqi = null; - while (Interface.CurrentInterface.LayoutingQueue.Count > 0) { - lqi = Interface.CurrentInterface.LayoutingQueue.Dequeue (); + while (LayoutingQueue.Count > 0) { + lqi = LayoutingQueue.Dequeue (); lqi.ProcessLayouting (); } + LayoutingQueue = DiscardQueue; } + DiscardQueue = null; #if MEASURE_TIME layoutTime.Stop (); |