protected void initializeStack()
 {
     for (int i = m_top + 1; i < m_size; i++)
     {
         m_stack[i] = new DrawCommand();
     }
 }
 /// <summary>
 /// Resize the stack in a non-destructive way
 /// </summary>
 /// <param name="newSize">The new size of the stack</param>
 public void resize(int newSize)
 {
     if (newSize > m_size)
     {
         int nextSize = (newSize > m_size * 2) ? newSize : m_size * 2;
         DrawCommand[] tempStack = new DrawCommand[nextSize];
         for (int i = 0; i <= m_top; i++)
         {
             tempStack[i] = m_stack[i];
         }
         m_stack = tempStack;
         m_size = nextSize;
         initializeStack();
     }
 }
 /// <summary>
 /// Pushes a DrawCommand onto the DrawStack to be drawn.
 /// If possible, it is better to use pushGet() for garbage reasons.
 /// </summary>
 /// <param name="drawCommand">Draw command to be drawn.</param>
 internal void push(DrawCommand drawCommand)
 {
     if (m_top == m_size - 1)
     {
         resize(m_size + 1);
     }
     m_top++;
     m_stack[m_top] = drawCommand;
 }