openMSX
FBPostProcessor.hh
Go to the documentation of this file.
1 #ifndef FBPOSTPROCESSOR_HH
2 #define FBPOSTPROCESSOR_HH
3 
4 #include "MemBuffer.hh"
5 #include "PixelOperations.hh"
6 #include "PostProcessor.hh"
7 #include "RenderSettings.hh"
8 #include "ScalerOutput.hh"
9 #include <concepts>
10 
11 namespace openmsx {
12 
13 class MSXMotherBoard;
14 class Display;
15 template<std::unsigned_integral Pixel> class Scaler;
16 
19 template<std::unsigned_integral Pixel>
20 class FBPostProcessor final : public PostProcessor
21 {
22 public:
24  MSXMotherBoard& motherBoard, Display& display,
25  OutputSurface& screen, const std::string& videoSource,
26  unsigned maxWidth, unsigned height, bool canDoInterlace);
27  ~FBPostProcessor() override;
28  FBPostProcessor(const FBPostProcessor&) = delete;
30 
31  // Layer interface:
32  void paint(OutputSurface& output) override;
33 
34  [[nodiscard]] std::unique_ptr<RawFrame> rotateFrames(
35  std::unique_ptr<RawFrame> finishedFrame, EmuTime::param time) override;
36 
37 private:
38  void preCalcNoise(float factor);
39  void drawNoise(OutputSurface& output);
40  void drawNoiseLine(Pixel* buf, signed char* noise,
41  size_t width);
42 
43  // Observer<Setting>
44  void update(const Setting& setting) noexcept override;
45 
46 private:
49  std::unique_ptr<Scaler<Pixel>> currScaler;
50 
53  std::unique_ptr<ScalerOutput<Pixel>> stretchScaler;
54 
57  RenderSettings::ScaleAlgorithm scaleAlgorithm;
58 
61  unsigned scaleFactor;
62 
65  unsigned stretchWidth;
66 
69  OutputSurface* lastOutput = nullptr;
70 
73  MemBuffer<uint16_t> noiseShift;
74 
75  PixelOperations<Pixel> pixelOps;
76 };
77 
78 } // namespace openmsx
79 
80 #endif // FBPOSTPROCESSOR_HH
BaseSetting * setting
Definition: Interpreter.cc:27
Represents the output window/screen of openMSX.
Definition: Display.hh:33
Rasterizer using SDL.
FBPostProcessor(MSXMotherBoard &motherBoard, Display &display, OutputSurface &screen, const std::string &videoSource, unsigned maxWidth, unsigned height, bool canDoInterlace)
FBPostProcessor & operator=(const FBPostProcessor &)=delete
FBPostProcessor(const FBPostProcessor &)=delete
void paint(OutputSurface &output) override
Paint this layer.
std::unique_ptr< RawFrame > rotateFrames(std::unique_ptr< RawFrame > finishedFrame, EmuTime::param time) override
Sets up the "abcdFrame" variables for a new frame.
A frame buffer where pixels can be written to.
Abstract base class for post processors.
OutputSurface & screen
The surface which is visible to the user.
ScaleAlgorithm
Scaler algorithm.
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint32_t Pixel