コード例 #1
0
 public LayoutingQueueItem(LayoutingType _layoutType, ILayoutable _graphicObject)
 {
     LayoutType = _layoutType;
     Layoutable = _graphicObject;
     Layoutable.RegisteredLayoutings |= LayoutType;
                 #if DEBUG_LAYOUTING
     if (graphicObject.CurrentDrawLQIs == null)
     {
         graphicObject.CurrentDrawLQIs = new List <LayoutingQueueItem>();
     }
     graphicObject.CurrentDrawLQIs.Add(this);
     if (currentLQI != null)
     {
         wasTriggeredBy = currentLQI;
         currentLQI.triggeredLQIs.Add(this);
     }
                 #endif
 }
コード例 #2
0
 public void ProcessLayouting()
 {
     if (Layoutable.Parent == null)              //TODO:improve this
     //cancel layouting for object without parent, maybe some were in queue when
     //removed from a listbox
     {
         Debug.WriteLine("ERROR: processLayouting, no parent for: " + this.ToString());
         return;
     }
                 #if DEBUG_LAYOUTING
     currentLQI = this;
     processedLQIs.Add(this);
     LQITime.Start();
                 #endif
     if (!Layoutable.UpdateLayout(LayoutType))
     {
         if (LayoutingTries < Interface.MaxLayoutingTries)
         {
             LayoutingTries++;
             Layoutable.RegisteredLayoutings |= LayoutType;
             (Layoutable as GraphicObject).CurrentInterface.LayoutingQueue.Enqueue(this);
         }
         else if (DiscardCount < Interface.MaxDiscardCount)
         {
             LayoutingTries = 0;
             DiscardCount++;
             Layoutable.RegisteredLayoutings |= LayoutType;
             (Layoutable as GraphicObject).CurrentInterface.DiscardQueue.Enqueue(this);
         }
                         #if DEBUG_LAYOUTING
         else
         {
             Debug.WriteLine("\tDELETED    => " + this.ToString());
         }
                         #endif
     }
                 #if DEBUG_LAYOUTING
     currentLQI = null;
     LQITime.Stop();
                 #endif
 }
コード例 #3
0
ファイル: NUnitCrowWindow.cs プロジェクト: jpbruyere/crow.deb
        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");
        }