public void AddSampleBuffer(CMSampleBuffer sampleBuffer) { var stopwatch = new Stopwatch(); stopwatch.Start(); using (var image = CreateImage(sampleBuffer)) { var imageRect = new Rectangle(0, 0, image.Width, image.Height); var maskRects = new List <RectangleF> (); var maskRect = new Rectangle(stripeSize.Width * stripeIndex, 0, stripeSize.Width, stripeSize.Height); while (maskRect.X < imageSize.Width) { maskRects.Add(maskRect); maskRect.X += stripeSize.Width * stride; } renderContext.SaveState(); renderContext.ClipToRects(maskRects.ToArray()); renderContext.DrawImage(imageRect, image); renderContext.RestoreState(); } stopwatch.Stop(); Console.WriteLine("Render time for contributor {0}: {1} msec", stripeIndex, stopwatch.Elapsed); stripeIndex = (stripeIndex + 1) % stride; }