private void appendScanlinesToFrameBuilder(IEnumerable <IScanline> scanLines, Queue <IFrame> queueOfCommittedFrames, ref FrameBuilder frameBuilder) { foreach (var scanLine in scanLines) { frameBuilder.Lines.Add(scanLine); if (frameBuilder.Lines.Count == SCANLINES_PER_FRAME) { queueOfCommittedFrames.Enqueue(frameBuilder.Commit()); frameBuilder = new FrameBuilder(); } } }