openMSX
LDSDLRasterizer.cc
Go to the documentation of this file.
1 #include "LDSDLRasterizer.hh"
2 #include "RawFrame.hh"
3 #include "PostProcessor.hh"
4 #include "OutputSurface.hh"
5 #include "PixelFormat.hh"
6 #include "build-info.hh"
7 #include "components.hh"
8 #include <cstdint>
9 #include <memory>
10 
11 namespace openmsx {
12 
13 template <class Pixel>
15  OutputSurface& screen,
16  std::unique_ptr<PostProcessor> postProcessor_)
17  : postProcessor(std::move(postProcessor_))
18  , workFrame(std::make_unique<RawFrame>(screen.getPixelFormat(), 640, 480))
19 {
20 }
21 
22 template <class Pixel>
24 
25 template <class Pixel>
27 {
28  return postProcessor.get();
29 }
30 
31 template <class Pixel>
32 void LDSDLRasterizer<Pixel>::frameStart(EmuTime::param time)
33 {
34  workFrame = postProcessor->rotateFrames(std::move(workFrame), time);
35 }
36 
37 template<class Pixel>
38 void LDSDLRasterizer<Pixel>::drawBlank(int r, int g, int b)
39 {
40  // We should really be presenting the "LASERVISION" text
41  // here, like the real laserdisc player does. Note that this
42  // changes when seeking or starting to play.
43  auto background = static_cast<Pixel>(workFrame->getPixelFormat().map(r, g, b));
44  for (int y = 0; y < 480; ++y) {
45  workFrame->setBlank(y, background);
46  }
47 }
48 
49 template<class Pixel>
51 {
52  return workFrame.get();
53 }
54 
55 
56 // Force template instantiation.
57 #if HAVE_16BPP
58 template class LDSDLRasterizer<uint16_t>;
59 #endif
60 #if HAVE_32BPP || COMPONENT_GL
61 template class LDSDLRasterizer<uint32_t>;
62 #endif
63 
64 } // namespace openmsx
RawFrame.hh
openmsx::LDSDLRasterizer::drawBlank
void drawBlank(int r, int g, int b) override
Definition: LDSDLRasterizer.cc:38
openmsx::LDSDLRasterizer::getRawFrame
RawFrame * getRawFrame() override
Definition: LDSDLRasterizer.cc:50
PostProcessor.hh
build-info.hh
openmsx::PostProcessor
Abstract base class for post processors.
Definition: PostProcessor.hh:29
openmsx::RawFrame
A video frame as output by the VDP scanline conversion unit, before any postprocessing filters are ap...
Definition: RawFrame.hh:25
g
int g
Definition: ScopedAssign_test.cc:20
components.hh
OutputSurface.hh
openmsx::LDSDLRasterizer::~LDSDLRasterizer
~LDSDLRasterizer() override
openmsx::OutputSurface
A frame buffer where pixels can be written to.
Definition: OutputSurface.hh:19
LDSDLRasterizer.hh
openmsx::LDSDLRasterizer::getPostProcessor
PostProcessor * getPostProcessor() const override
Definition: LDSDLRasterizer.cc:26
openmsx::LDSDLRasterizer::LDSDLRasterizer
LDSDLRasterizer(OutputSurface &screen, std::unique_ptr< PostProcessor > postProcessor)
Definition: LDSDLRasterizer.cc:14
PixelFormat.hh
openmsx::LDSDLRasterizer
Rasterizer using a frame buffer approach: it writes pixels to a single rectangular pixel buffer.
Definition: LDSDLRasterizer.hh:17
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::LDSDLRasterizer::frameStart
void frameStart(EmuTime::param time) override
Definition: LDSDLRasterizer.cc:32