title: Is System.Drawing too slow for what we wish to do?
body: <p>I'm currently working on the user interface of a win forms application. The primary window is a borderless form whose surface area is almost entirely rendered in the Form.Paint event. A back buffer is created and it's drawn fairly conventionally:</p>
  
  <pre><code>private void form_Paint(object sender, PaintEventArgs e) {
    e.Graphics.DrawImage(BackBuffer, e.ClipRectangle, e.ClipRectangle, GraphicsUnit.Pixel);
  }
  </code></pre>
  
  <p>Certain regions of the back buffer get redrawn under various conditions; mouse-over effects are quite common. The class which does redrawing carefully invalidates only applicable areas. In spite of this, simply swiping the mouse across the form is enough to crank a high-end CPU to > 50% usage for several seconds.</p>
  
  <p>I've profiled the application and well over 80% of the CPU time is being burnt on the call to DrawImage above. I knew that GDI+ is slow and employs no (little?) use of GPU... and the target platform for the application makes no guarantee that the GPU wont be integrated in the first place. But I had no idea that it was this bad.</p>
  
  <p>Should I face the fact that GDI+ is just not fast enough for what we wish to do, or is there an opportunity for improvement in the code, still?</p>
  
  <p><strong>-edit-</strong></p>
  
  <p>BackBuffer represents a bitmap which is created during system startup. Its size matches the screen resolution. Various regions are drawn on it during a variety of events such as mouse overs and clicks. It is created rather simply:</p>
  
  <pre><code>this.BufferBmp = new Bitmap(screenWidth, screenHeight);
  this.Gfx = Graphics.FromImage(BufferBmp);
  
  Gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
  </code></pre>