void UpdateCache()
{
if (!allocated)
return;
if (bitmap_cache != null)
bitmap_cache.Dispose ();
int width = current_allocation.Width;
int height = current_allocation.Height;
bitmap_cache = new System.Drawing.Bitmap (width, height);
using (Graphics g = Graphics.FromImage (bitmap_cache)) {
// wrong: since x,y usually > 0 -> plot shifted down and right: current_allocation.X, current_allocation.Y
var bounds = new Rectangle (0, 0, width, height);
this.InteractivePlotSurface2D.DoDraw (g, bounds);
}
}