/// <summary>
        /// Keeps the text view data in sync with this surface.
        /// </summary>
        protected virtual void ResetArea()
        {
            RenderRects = new Rectangle[area.Width * area.Height];
            RenderCells = new Cell[area.Width * area.Height];

            int index = 0;

            for (int y = 0; y < area.Height; y++)
            {
                for (int x = 0; x < area.Width; x++)
                {
                    RenderRects[index] = font.GetRenderRect(x, y);
                    RenderCells[index] = cells[(y + area.Top) * width + (x + area.Left)];
                    index++;
                }
            }

            // TODO: Optimization by calculating AbsArea and seeing if it's diff from current, if so, don't create new RenderRects
            AbsoluteArea = new Rectangle(0, 0, area.Width * font.Size.X, area.Height * font.Size.Y);

            if (BackbufferImage != null)
            {
                BackbufferImage.Dispose();
            }
            BackbufferImage = new Bitmap(AbsoluteArea.Width, AbsoluteArea.Height);

            if (Backbuffer != null)
            {
                Backbuffer.Dispose();
            }
            Backbuffer = Graphics.FromImage(BackbufferImage);
        }
 public void Dispose()
 {
     if (BackbufferImage != null)
     {
         BackbufferImage.Dispose();
     }
     if (Backbuffer != null)
     {
         Backbuffer.Dispose();
     }
 }