openMSX
DirectScalerOutput.hh
Go to the documentation of this file.
1#ifndef DIRECTSCALEROUTPUT_HH
2#define DIRECTSCALEROUTPUT_HH
3
4#include "ScalerOutput.hh"
5#include "SDLOutputSurface.hh"
6#include <concepts>
7#include <optional>
8
9namespace openmsx {
10
11template<std::unsigned_integral Pixel>
12class DirectScalerOutput final : public ScalerOutput<Pixel>
13{
14public:
15 explicit DirectScalerOutput(SDLOutputSurface& output);
16
17 [[nodiscard]] unsigned getWidth() const override {
18 return output.getLogicalWidth();
19 }
20 [[nodiscard]] unsigned getHeight() const override {
21 return output.getLogicalHeight();
22 }
23
24 void frameStart() override {
25 pixelAccess.emplace(output.getDirectPixelAccess());
26 }
27 void frameStop() override {
28 pixelAccess.reset();
29 }
30
31 [[nodiscard]] std::span<Pixel> acquireLine(unsigned y) override;
32 void releaseLine(unsigned y, std::span<Pixel> buf) override;
33 void fillLine (unsigned y, Pixel color) override;
34
35private:
36 SDLOutputSurface& output;
37 std::optional<SDLDirectPixelAccess> pixelAccess;
38};
39
40} // namespace openmsx
41
42#endif
void fillLine(unsigned y, Pixel color) override
void releaseLine(unsigned y, std::span< Pixel > buf) override
DirectScalerOutput(SDLOutputSurface &output)
unsigned getWidth() const override
std::span< Pixel > acquireLine(unsigned y) override
unsigned getHeight() const override
int getLogicalWidth() const
int getLogicalHeight() const
A frame buffer where pixels can be written to.
SDLDirectPixelAccess getDirectPixelAccess()
Return a SDLDirectPixelAccess object.
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint32_t Pixel