8 const SDL_PixelFormat& format,
unsigned maxWidth_,
unsigned height_)
14 unsigned bytesPerPixel = format.BytesPerPixel;
19 pitch = ((bytesPerPixel * maxWidth) + 63) & ~63;
20 data.
resize(pitch * height_);
22 maxWidth = pitch / bytesPerPixel;
26 for (
unsigned line = 0; line < height_; line++) {
27 if (bytesPerPixel == 2) {
28 setBlank(line, static_cast<uint16_t>(0));
30 setBlank(line, static_cast<uint32_t>(0));
38 return lineWidths[line];
42 unsigned line,
unsigned& width,
43 void* ,
unsigned )
const 46 width = lineWidths[line];
47 return data.
data() + line * pitch;
void init(FieldType fieldType_)
(Re)initialize an existing FrameSource.
unsigned getLineWidth(unsigned line) const override
Gets the number of display pixels on the given line.
const void * getLineInfo(unsigned line, unsigned &width, void *buf, unsigned bufWidth) const override
Abstract implementation of getLinePtr().
Interface for getting lines from a video frame.
void resize(size_t size)
Grow or shrink the memory block.
const T * data() const
Returns pointer to the start of the memory buffer.
RawFrame(const SDL_PixelFormat &format, unsigned maxWidth, unsigned height)
Thanks to enen for testing this on a real cartridge:
bool hasContiguousStorage() const override
Returns true when two consecutive rows are also consecutive in memory.
Interlacing is off for this frame.
unsigned getRowLength() const override
Returns the distance (in pixels) between two consecutive lines.
void setBlank(unsigned line, Pixel color)
void setHeight(unsigned height_)
unsigned getHeight() const
Gets the number of lines in this frame.