protected int RenderArtificialLife(Pixbuf pixbuf, ArtificialLife artificialLife, int x, int y, bool Clear = true) { var Updates = 0; if (pixbuf != null && artificialLife != null) { var writeBuffer = artificialLife.GetPixelWriteBuffer(); Updates += writeBuffer.Count; if (writeBuffer.Count > 0) { Parallel.ForEach(writeBuffer, (pixel) => { pixel.Write(pixbuf, x, y); }); if (Clear) { artificialLife.ClearPixelWriteBuffer(); } } } return(Updates); }