public void Update() { ctx = new Context(surf); guTime.Reset(); updateTime.Restart(); layoutTime.Restart(); GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count]; GraphicObjects.CopyTo(invGOList, 0); invGOList = invGOList.Reverse().ToArray(); //Debug.WriteLine ("======= Layouting queue start ======="); while (Interface.CurrentInterface.LayoutingQueue.Count > 0) { LayoutingQueueItem lqi = Interface.CurrentInterface.LayoutingQueue.Dequeue(); lqi.ProcessLayouting(); } layoutTime.Stop(); //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-"); //final redraw clips should be added only when layout is completed among parents, //that's why it take place in a second pass GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count]; gobjsToRedraw.CopyTo(gotr); gobjsToRedraw.Clear(); foreach (GraphicObject p in gotr) { p.IsInRedrawList = false; p.Parent.RegisterClip(p.LastPaintedSlot); p.Parent.RegisterClip(p.getSlot()); } guTime.Start(); using (ctx = new Context(surf)){ if (clipping.count > 0) { //Link.draw (ctx); clipping.clearAndClip(ctx); foreach (GraphicObject p in invGOList) { if (!p.Visible) { continue; } ctx.Save(); p.Paint(ref ctx); ctx.Restore(); } #if DEBUG_CLIP_RECTANGLE clipping.stroke(ctx, Color.Red.AdjustAlpha(0.5)); #endif clipping.Reset(); } } guTime.Stop(); updateTime.Stop(); sw.WriteLine("{0}\t{1,8}\t{2,8}\t{3,8}\t{4,8}", testId, layoutTime.ElapsedTicks, guTime.ElapsedTicks, updateTime.ElapsedTicks, loadTime.ElapsedTicks); sw.Flush(); // Console.WriteLine("{3} => layout:{0}ms\tdraw{1}ms\tupdate:{2}ms", // layoutTime.ElapsedMilliseconds, // guTime.ElapsedMilliseconds, // updateTime.ElapsedMilliseconds, // testId); //surf.WriteToPng (@"ExpectedOutputs/" + testId + ".png"); surf.WriteToPng(@"tmp.png"); }
public void Update () { ctx = new Context(surf); guTime.Reset (); updateTime.Restart (); layoutTime.Restart (); GraphicObject[] invGOList = new GraphicObject[GraphicObjects.Count]; GraphicObjects.CopyTo (invGOList, 0); invGOList = invGOList.Reverse ().ToArray (); //Debug.WriteLine ("======= Layouting queue start ======="); while (Interface.CurrentInterface.LayoutingQueue.Count > 0) { LayoutingQueueItem lqi = Interface.CurrentInterface.LayoutingQueue.Dequeue (); lqi.ProcessLayouting (); } layoutTime.Stop (); //Debug.WriteLine ("otd:" + gobjsToRedraw.Count.ToString () + "-"); //final redraw clips should be added only when layout is completed among parents, //that's why it take place in a second pass GraphicObject[] gotr = new GraphicObject[gobjsToRedraw.Count]; gobjsToRedraw.CopyTo (gotr); gobjsToRedraw.Clear (); foreach (GraphicObject p in gotr) { p.IsInRedrawList = false; p.Parent.RegisterClip (p.LastPaintedSlot); p.Parent.RegisterClip (p.getSlot()); } guTime.Start (); using (ctx = new Context (surf)){ if (clipping.count > 0) { //Link.draw (ctx); clipping.clearAndClip(ctx); foreach (GraphicObject p in invGOList) { if (!p.Visible) continue; ctx.Save (); p.Paint (ref ctx); ctx.Restore (); } #if DEBUG_CLIP_RECTANGLE clipping.stroke (ctx, Color.Red.AdjustAlpha(0.5)); #endif clipping.Reset (); } } guTime.Stop (); updateTime.Stop (); sw.WriteLine ("{0}\t{1,8}\t{2,8}\t{3,8}\t{4,8}", testId, layoutTime.ElapsedTicks, guTime.ElapsedTicks, updateTime.ElapsedTicks, loadTime.ElapsedTicks); sw.Flush (); // Console.WriteLine("{3} => layout:{0}ms\tdraw{1}ms\tupdate:{2}ms", // layoutTime.ElapsedMilliseconds, // guTime.ElapsedMilliseconds, // updateTime.ElapsedMilliseconds, // testId); //surf.WriteToPng (@"ExpectedOutputs/" + testId + ".png"); surf.WriteToPng (@"tmp.png"); }