diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/DebugEvents/DebugEvent.cs | 8 | ||||
| -rw-r--r-- | src/GraphicObjects/Wrapper.cs | 4 | ||||
| -rw-r--r-- | src/Interface.cs | 65 |
3 files changed, 43 insertions, 34 deletions
diff --git a/src/DebugEvents/DebugEvent.cs b/src/DebugEvents/DebugEvent.cs index 68ae40e7..8b49d365 100644 --- a/src/DebugEvents/DebugEvent.cs +++ b/src/DebugEvents/DebugEvent.cs @@ -64,6 +64,9 @@ namespace Crow public DebugEvent Parent; public List<DebugEvent> ChildEvents = new List<DebugEvent>(); + public long Ticks { get { return Time.ElapsedTicks; }} + + public virtual void Start () { Time = Stopwatch.StartNew(); } @@ -119,6 +122,11 @@ namespace Crow saveTargetState (); PreviousSlot = Target.LastSlots; } + + public override string ToString () + { + return string.Format ("{0} {1} {2} {3} => {4}", Target, LayoutingType, EndResult, PreviousSlot, Slot); + } } #endif } diff --git a/src/GraphicObjects/Wrapper.cs b/src/GraphicObjects/Wrapper.cs index 43ffedc6..3172e83c 100644 --- a/src/GraphicObjects/Wrapper.cs +++ b/src/GraphicObjects/Wrapper.cs @@ -214,10 +214,6 @@ namespace Crow } public override void OnLayoutChanges (LayoutingType layoutType) { - #if DEBUG_LAYOUTING - IFace.currentLQI.Slot = LastSlots; - IFace.currentLQI.Slot = Slot; - #endif switch (layoutType) { case LayoutingType.Width: childrenRWLock.EnterReadLock (); diff --git a/src/Interface.cs b/src/Interface.cs index 4fc7e669..3b864288 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -588,9 +588,9 @@ namespace Crow /// Result: the Interface bitmap is drawn in memory (byte[] bmp) and a dirtyRect and bitmap are available /// </summary> public void Update(){ - #if DBG_EVENTS - DbgStartSubEvt(DbgEvtType.IFaceUpdate); - #endif +// #if DBG_EVENTS +// DbgStartSubEvt(DbgEvtType.IFaceUpdate); +// #endif if (armedClickSender != null && clickTimer.ElapsedMilliseconds >= Interface.DoubleClick) { armedClickSender.onMouseClick (armedClickSender, armedClickEvtArgs); @@ -627,9 +627,9 @@ namespace Crow Monitor.Exit (UpdateMutex); - #if DBG_EVENTS - DbgEndSubEvt (); - #endif +// #if DBG_EVENTS +// DbgEndSubEvt (); +// #endif } #if DEBUG_LAYOUTING public string BreakingName; @@ -638,13 +638,18 @@ namespace Crow /// Layouting queue items. Failing LQI's are requeued in this cycle until MaxTry is reached which /// trigger an enqueue for the next Update Cycle</summary> protected virtual void processLayouting(){ - #if DBG_EVENTS - DbgStartSubEvt(DbgEvtType.IFaceLayouting); - #endif - if (Monitor.TryEnter (LayoutMutex)) { DiscardQueue = new Queue<LayoutingQueueItem> (); LayoutingQueueItem lqi; + + #if DBG_EVENTS + bool logLayouting = false; + if (LayoutingQueue.Count > 0){ + DbgStartSubEvt(DbgEvtType.IFaceLayouting); + logLayouting = true; + } + #endif + while (LayoutingQueue.Count > 0) { lqi = LayoutingQueue.Dequeue (); #if DBG_EVENTS @@ -655,19 +660,23 @@ namespace Crow DbgEndSubEvt(); #endif } + + #if DBG_EVENTS + if (logLayouting) + DbgEndSubEvt(); + #endif + LayoutingQueue = DiscardQueue; Monitor.Exit (LayoutMutex); DiscardQueue = null; } - - #if DBG_EVENTS - DbgEndSubEvt(); - #endif } /// <summary>Degueue Widget to clip from DrawingQueue and register the last painted slot and the new one /// Clipping rectangles are added at each level of the tree from leef to root, that's the way for the painting /// operation to known if it should go down in the tree for further graphic updates and repaints</summary> void clippingRegistration(){ + if (ClippingQueue.Count == 0) + return; #if DBG_EVENTS DbgStartSubEvt(DbgEvtType.IFaceClipping); #endif @@ -686,15 +695,16 @@ namespace Crow } /// <summary>Clipping Rectangles drive the drawing process. For compositing, each object under a clip rectangle should be /// repainted. If it contains also clip rectangles, its cache will be update, or if not cached a full redraw will take place</summary> - void processDrawing(){ - #if DBG_EVENTS - DbgStartSubEvt(DbgEvtType.IFaceDrawing); - #endif + void processDrawing(){ + if (DragImage != null) clipping.UnionRectangle(new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight)); using (surf = new ImageSurface (bmp, Format.Argb32, ClientRectangle.Width, ClientRectangle.Height, ClientRectangle.Width * 4)) { using (ctx = new Context (surf)){ if (!clipping.IsEmpty) { + #if DBG_EVENTS + DbgStartSubEvt(DbgEvtType.IFaceDrawing); + #endif for (int i = 0; i < clipping.NumRectangles; i++) ctx.Rectangle(clipping.GetRectangle(i)); @@ -731,6 +741,9 @@ namespace Crow //Console.WriteLine ("dragimage drawn: {0},{1}", DragImageX, DragImageY); } } + #if DBG_EVENTS + DbgEndSubEvt (); + #endif #if DEBUG_CLIP_RECTANGLE clipping.stroke (ctx, Color.Red.AdjustAlpha(0.5)); @@ -768,9 +781,6 @@ namespace Crow //surf.WriteToPng (@"/mnt/data/test.png"); } } - #if DBG_EVENTS - DbgEndSubEvt (); - #endif } #endregion @@ -836,12 +846,6 @@ namespace Crow g.Dispose (); } } - #if DEBUG_LAYOUTING - LQIsTries = new List<LQIList>(); - curLQIsTries = new LQIList(); - LQIs = new List<LQIList>(); - curLQIs = new LQIList(); - #endif } /// <summary> Put widget on top of other root widgets</summary> public void PutOnTop(GraphicObject g, bool isOverlay = false) @@ -871,12 +875,13 @@ namespace Crow /// <summary>Search a Graphic object in the tree named 'nameToFind'</summary> public GraphicObject FindByName (string nameToFind) { + GraphicObject r = null; foreach (GraphicObject w in GraphicTree) { - GraphicObject r = w.FindByName (nameToFind); + r = w.FindByName (nameToFind); if (r != null) - return r; + break; } - return null; + return r; } #endregion |