using System;
namespace EMU7800.Core
{
public class FrameBuffer
{
///
/// Number of visible pixels on a single horizontal line.
///
public int VisiblePitch { get; private set; }
///
/// Number of s that represent VisiblePitch.
///
//public int VideoBufferElementVisiblePitch { get; private set; }
///
/// Number of visible scan lines.
///
public int Scanlines { get; private set; }
///
/// The number of bytes contained by VideoBuffer.
///
public int VideoBufferByteLength { get; private set; }
///
/// The number of s contained by VideoBuffer
///
//public int VideoBufferElementLength { get; private set; }
///
/// The number of bytes contained by SoundBuffer.
///
public int SoundBufferByteLength { get; private set; }
///
/// The number of s contained by SoundBuffer
///
//public int SoundBufferElementLength { get; private set; }
///
/// The buffer containing computed pixel data.
///
public byte[] VideoBuffer { get; private set; }
///
/// The buffer containing computed PCM audio data.
///
public byte[] SoundBuffer { get; private set; }
#region Constructors
private FrameBuffer()
{
}
internal FrameBuffer(int visiblePitch, int scanLines)
{
if (visiblePitch < 0)
throw new ArgumentException("visiblePitch must be non-negative.");
if (scanLines < 0)
throw new ArgumentException("scanLines must be non-negative.");
VisiblePitch = visiblePitch;
//VideoBufferElementVisiblePitch = VisiblePitch >> BufferElement.SHIFT;
Scanlines = scanLines;
VideoBufferByteLength = VisiblePitch * Scanlines;
//VideoBufferElementLength = VideoBufferElementVisiblePitch * Scanlines;
SoundBufferByteLength = Scanlines << 1;
//SoundBufferElementLength = SoundBufferByteLength >> BufferElement.SHIFT;
VideoBuffer = new byte[VideoBufferByteLength + 64];
SoundBuffer = new byte[SoundBufferByteLength + 64];
}
#endregion
}
}