| e8555c89 Andy McCall |
1 |
#include "RawFrame.hh" |
| 2 |
|
| 3 |
namespace openmsx { |
| 4 |
|
| 5 |
[[nodiscard]] static unsigned calcMaxWidth(unsigned maxWidth) |
| 6 |
{ |
| 7 |
unsigned bytes = maxWidth * sizeof(RawFrame::Pixel); |
| 8 |
bytes = (bytes + 63) & ~63; |
| 9 |
return bytes / sizeof(RawFrame::Pixel); |
| 10 |
} |
| 11 |
|
| 12 |
RawFrame::RawFrame(unsigned maxWidth_, unsigned height_) |
| 13 |
: lineWidths(height_) |
| 14 |
, maxWidth(calcMaxWidth(maxWidth_)) |
| 15 |
{ |
| 16 |
setHeight(height_); |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
data.resize(size_t(maxWidth) * height_); |
| 22 |
|
| 23 |
|
| 24 |
init(FieldType::NONINTERLACED); |
| 25 |
for (auto line : xrange(height_)) { |
| 26 |
setBlank(line, Pixel(0)); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
unsigned RawFrame::getLineWidth(unsigned line) const |
| 31 |
{ |
| 32 |
assert(line < getHeight()); |
| 33 |
return lineWidths[line]; |
| 34 |
} |
| 35 |
|
| 36 |
std::span<const RawFrame::Pixel> RawFrame::getUnscaledLine( |
| 37 |
unsigned line, std::span<Pixel> ) const |
| 38 |
{ |
| 39 |
return getLineDirect(line).first(lineWidths[line]); |
| 40 |
} |
| 41 |
|
| 42 |
bool RawFrame::hasContiguousStorage() const |
| 43 |
{ |
| 44 |
return true; |
| 45 |
} |
| 46 |
|
| 47 |
} |