]> O.S.I.I.S - jp/crow.git/commitdiff
* Interface.cs:
authorjpbruyere <jp.bruyere@hotmail.com>
Wed, 4 Jan 2017 10:43:15 +0000 (11:43 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Wed, 4 Jan 2017 10:43:15 +0000 (11:43 +0100)
  maxLayoutTries = 3; max discard = 5, test if dirtyRect.width != 0, lqi logging removed because lqi is now a struct

* LayoutingQueueItem.cs:
  lqi logging removed

src/Interface.cs
src/LayoutingQueueItem.cs

index de348d94ddf9f9e06d10be6da18babd7ced3381c..ddd5bfcfc25e0d9ddd831f03c003332100d4aecb 100644 (file)
@@ -82,8 +82,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 = 5;
-               public const int MaxDiscardCount = 10;
+               public const int MaxLayoutingTries = 3;
+               public const int MaxDiscardCount = 5;
                /// <summary> Global font rendering settings for Cairo </summary>
                public static FontOptions FontRenderingOptions;
                #endregion
@@ -321,7 +321,7 @@ namespace Crow
 //             public static LayoutingQueueItem[] MultipleRunsLQIs {
 //                     get { return curUpdateLQIs.Where(l=>l.LayoutingTries>2 || l.DiscardCount > 0).ToArray(); }
 //             }
-               public LayoutingQueueItem currentLQI = null;
+               public LayoutingQueueItem currentLQI;
                #else
                public List<LQIList> LQIs = null;//still create the var for CrowIDE
                #endif
@@ -384,9 +384,6 @@ namespace Crow
                                        curLQIsTries.Add(currentLQI);
                                        #endif
                                        lqi.ProcessLayouting ();
-                                       #if DEBUG_LAYOUTING
-                                       currentLQI = null;
-                                       #endif
                                }
                                LayoutingQueue = DiscardQueue;
                        }
@@ -406,8 +403,7 @@ namespace Crow
                                        g = DrawingQueue.Dequeue ();
                                g.IsQueueForRedraw = false;
                                g.Parent.RegisterClip (g.LastPaintedSlot);
-                               if (g.getSlot () != g.LastPaintedSlot)
-                                       g.Parent.RegisterClip (g.getSlot ());
+                               g.Parent.RegisterClip (g.getSlot ());
                        }
 
                        #if MEASURE_TIME
@@ -454,12 +450,15 @@ namespace Crow
                                                        DirtyRect.Width = Math.Max (0, DirtyRect.Width);
                                                        DirtyRect.Height = Math.Max (0, DirtyRect.Height);
 
-                                                       dirtyBmp = new byte[4 * DirtyRect.Width * DirtyRect.Height];
-                                                       for (int y = 0; y < DirtyRect.Height; y++) {
-                                                               Array.Copy (bmp,
-                                                                       ((DirtyRect.Top + y) * ClientRectangle.Width * 4) + DirtyRect.Left * 4,
-                                                                       dirtyBmp, y * DirtyRect.Width * 4, DirtyRect.Width * 4);
-                                                       }
+                                                       if (DirtyRect.Width > 0) {
+                                                               dirtyBmp = new byte[4 * DirtyRect.Width * DirtyRect.Height];
+                                                               for (int y = 0; y < DirtyRect.Height; y++) {
+                                                                       Array.Copy (bmp,
+                                                                               ((DirtyRect.Top + y) * ClientRectangle.Width * 4) + DirtyRect.Left * 4,
+                                                                               dirtyBmp, y * DirtyRect.Width * 4, DirtyRect.Width * 4);
+                                                               }
+                                                       } else
+                                                               IsDirty = false;
                                                }
                                                clipping.Reset ();
                                        }
index 61646b15be140ecd4c6aabc09c81e2663dca5e7e..95bc6bb725a29ea5d9d1598b74050f708a43fbf7 100644 (file)
@@ -38,6 +38,7 @@ namespace Crow
                ArrangeChildren = 0x10,
                All = 0xFF
        }
+
        /// <summary>
        /// Element class of the LayoutingQueue
        /// </summary>
@@ -51,9 +52,7 @@ namespace Crow
                public int LayoutingTries, DiscardCount;
 
                #if DEBUG_LAYOUTING
-               public Stopwatch LQITime = new Stopwatch();
-               public LQIList triggeredLQIs = new LQIList();
-               public LayoutingQueueItem wasTriggeredBy = null;
+               public Stopwatch LQITime;
                public GraphicObject graphicObject {
                        get { return Layoutable as GraphicObject; }
                }
@@ -69,25 +68,21 @@ namespace Crow
                public Measure Height {
                        get { return graphicObject.Height; }
                }
-               public bool HasTriggeredLQIs { get { return triggeredLQIs.Count > 0; }}
                public Rectangle Slot, NewSlot;
                #endif
 
                #region CTOR
                public LayoutingQueueItem (LayoutingType _layoutType, ILayoutable _graphicObject)
-               {
+               {                       
                        LayoutType = _layoutType;
                        Layoutable = _graphicObject;
                        Layoutable.RegisteredLayoutings |= LayoutType;
                        LayoutingTries = 0;
                        DiscardCount = 0;
                        #if DEBUG_LAYOUTING
-                       GraphicObject g = graphicObject;
-                       g.CurrentInterface.curLQIs.Add(this);
-                       if (g.CurrentInterface.currentLQI != null){
-                               wasTriggeredBy = g.CurrentInterface.currentLQI;
-                               g.CurrentInterface.currentLQI.triggeredLQIs.Add(this);
-                       }
+                       LQITime = new Stopwatch();
+                       Slot = Rectangle.Empty;
+                       NewSlot = Rectangle.Empty;
                        #endif
                }
                #endregion
@@ -124,10 +119,9 @@ namespace Crow
                        }
                        #if DEBUG_LAYOUTING
                        else{
-                               if (LayoutingTries > 1 || DiscardCount > 0)
+                               if (LayoutingTries > 2 || DiscardCount > 0)
                                        Debug.WriteLine (this.ToString ());
                        }
-
                        LQITime.Stop();
                        #endif
                }
@@ -152,11 +146,11 @@ namespace Crow
                }
        }
        public class LQIList : List<LayoutingQueueItem>{
-               #if DEBUG_LAYOUTING
-               public List<LayoutingQueueItem> GetRootLQIs(){
-                       return this.Where (lqi => lqi.wasTriggeredBy == null).ToList ();
-               }
-               #endif
+//             #if DEBUG_LAYOUTING
+//             public List<LayoutingQueueItem> GetRootLQIs(){
+//                     return this.Where (lqi => lqi.wasTriggeredBy == null).ToList ();
+//             }
+//             #endif
        }
 }