Exemple #1
0
 public static MayBeEmptyTempContext <LineBox> BorrowLineBox(out LineBox linebox)
 {
     if (!MayBeEmptyTempContext <LineBox> .IsInit())
     {
         MayBeEmptyTempContext <LineBox> .SetNewHandler(
             () => new LineBox(),
             line => line.Reset());
     }
     return(MayBeEmptyTempContext <LineBox> .Borrow(out linebox));
 }
Exemple #2
0
        public void FlushOnce()
        {
            if (_owner != null)
            {
                //in the case that we want to preserve linebox output
                List <RenderElemLineBox> lines = _owner.Lines;
                int j = _lineboxes.Count;
                if (lines == null)
                {
                    _owner.Lines = lines = new List <RenderElemLineBox>(j);
                }
                //clear only line content
                lines.Clear();
                for (int i = 0; i < j; ++i)
                {
                    LineBox linebox = _lineboxes[i];

                    RenderElemLineBox newline = new RenderElemLineBox
                    {
                        LineTop             = linebox.LineTop,
                        LineHeight          = linebox.LineHeight,
                        ParentRenderElement = _owner//***
                    };

                    lines.Add(newline);
                    LinkedListNode <IAbstractRect> node = linebox._linkList.First;
                    while (node != null)
                    {
                        //content in the node
                        newline.Add(node.Value.GetPrimaryRenderElement());
                        node = node.Next;//**
                    }
                }

                _owner = null;
            }
        }