osu.Framework/Graphics/Containers/CompositeDrawable.cs
/// <summary>
/// This function adds all children's <see cref="DrawNode"/>s to a target List, flattening the children of certain types
/// of <see cref="CompositeDrawable"/> subtrees for optimization purposes.
/// </summary>
/// <param name="frame">The frame which <see cref="DrawNode"/>s should be generated for.</param>
/// <param name="treeIndex">The index of the currently in-use <see cref="DrawNode"/> tree.</param>
/// <param name="forceNewDrawNode">Whether the creation of a new <see cref="DrawNode"/> should be forced, rather than re-using an existing <see cref="DrawNode"/>.</param>
/// <param name="j">The running index into the target List.</param>
/// <param name="parentComposite">The <see cref="CompositeDrawable"/> whose children's <see cref="DrawNode"/>s to add.</param>
/// <param name="target">The target list to fill with DrawNodes.</param>
This function adds all children's s to a target List, flattening the children of certain types
of  subtrees for optimization purposes.
This function adds all children ' s s to a target List flattening the children of certain types of subtrees for optimization purposes .
private static void addFromComposite(ulong frame, int treeIndex, bool forceNewDrawNode, ref int j, CompositeDrawable parentComposite, List<DrawNode> target)
        {
            SortedList<Drawable> children = parentComposite.aliveInternalChildren;
            for (int i = 0; i < children.Count; ++i)
            {
                Drawable drawable = children[i];
                if (!drawable.IsProxy)
                {
                    if (!drawable.IsPresent)
                        continue;
                    CompositeDrawable composite = drawable as CompositeDrawable;
                    if (composite?.CanBeFlattened == true)
                    {
                        if (!composite.IsMaskedAway)
                            addFromComposite(frame, treeIndex, forceNewDrawNode, ref j, composite, target);
                        continue;
                    }
                    if (drawable.IsMaskedAway)
                        continue;
                }
                DrawNode next = drawable.GenerateDrawNodeSubtree(frame, treeIndex, forceNewDrawNode);
                if (next == null)
                    continue;
                if (drawable.HasProxy)
                    drawable.ValidateProxyDrawNode(treeIndex, frame);
                else
                {
                    if (j < target.Count)
                        target[j] = next;
                    else
                        target.Add(next);
                    j++;
                }
            }
        }
private static void addFromComposite ( ulong frame , int treeIndex , bool forceNewDrawNode , ref int j , CompositeDrawable parentComposite , List < DrawNode > target ) { SortedList < Drawable > children = parentComposite . aliveInternalChildren ; for ( int i = 0 ; i < children . Count ; ++ i ) { Drawable drawable = children [ i ] ; if ( ! drawable . IsProxy ) { if ( ! drawable . IsPresent ) continue ; CompositeDrawable composite = drawable as CompositeDrawable ; if ( composite ? . CanBeFlattened == true ) { if ( ! composite . IsMaskedAway ) addFromComposite ( frame , treeIndex , forceNewDrawNode , ref j , composite , target ) ; continue ; } if ( drawable . IsMaskedAway ) continue ; } DrawNode next = drawable . GenerateDrawNodeSubtree ( frame , treeIndex , forceNewDrawNode ) ; if ( next == null ) continue ; if ( drawable . HasProxy ) drawable . ValidateProxyDrawNode ( treeIndex , frame ) ; else { if ( j < target . Count ) target [ j ] = next ; else target . Add ( next ) ; j ++ ; } } }
This function adds all children's s to a target List, flattening the children of certain types
of  subtrees for optimization purposes.
This function adds all children ' s s to a target List flattening the children of certain types of subtrees for optimization purposes .
frame
ulong
The frame which s should be generated for.
The frame which s should be generated for .
treeIndex
int
The index of the currently in-use  tree.
The index of the currently in - use tree .
forceNewDrawNode
bool
Whether the creation of a new  should be forced, rather than re-using an existing .
Whether the creation of a new should be forced rather than re - using an existing .
int
ref
parentComposite
CompositeDrawable
The  whose children's s to add.
The whose children ' s s to add .
target
List<DrawNode>
The target list to fill with DrawNodes.
The target list to fill with DrawNodes .
j
The running index into the target List.
The running index into the target List .