openMSX
DirectScalerOutput.cc
Go to the documentation of this file.
2#include "SDLOutputSurface.hh"
3#include "MemoryOps.hh"
4#include "build-info.hh"
5#include <cassert>
6#include <cstdint>
7
8namespace openmsx {
9
10template<std::unsigned_integral Pixel>
12 : output(output_)
13{
14}
15
16template<std::unsigned_integral Pixel>
17std::span<Pixel> DirectScalerOutput<Pixel>::acquireLine(unsigned y)
18{
19 assert(pixelAccess);
20 return pixelAccess->getLine<Pixel>(y).subspan(0, getWidth());
21}
22
23template<std::unsigned_integral Pixel>
24void DirectScalerOutput<Pixel>::releaseLine(unsigned y, std::span<Pixel> buf)
25{
26 assert(pixelAccess);
27 assert(buf.data() == pixelAccess->getLine<Pixel>(y).data());
28 assert(buf.size() == getWidth());
29 (void)y;
30 (void)buf;
31}
32
33template<std::unsigned_integral Pixel>
35{
36 assert(pixelAccess);
38 auto dstLine = pixelAccess->getLine<Pixel>(y).subspan(0, getWidth());
39 memset(dstLine, color);
40}
41
42
43// Force template instantiation.
44#if HAVE_16BPP
45template class DirectScalerOutput<uint16_t>;
46#endif
47#if HAVE_32BPP
48template class DirectScalerOutput<uint32_t>;
49#endif
50
51} // namespace openmsx
void fillLine(unsigned y, Pixel color) override
void releaseLine(unsigned y, std::span< Pixel > buf) override
DirectScalerOutput(SDLOutputSurface &output)
std::span< Pixel > acquireLine(unsigned y) override
A frame buffer where pixels can be written to.
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint32_t Pixel
constexpr auto subspan(Range &&range, size_t offset, size_t count=std::dynamic_extent)
Definition: ranges.hh:446