LDSDLRasterizer.cc 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. namespace openmsx {
  11. template <class Pixel>
  12. LDSDLRasterizer<Pixel>::LDSDLRasterizer(
  13. OutputSurface& screen,
  14. std::unique_ptr<PostProcessor> postProcessor_)
  15. : postProcessor(std::move(postProcessor_))
  16. , workFrame(std::make_unique<RawFrame>(screen.getPixelFormat(), 640, 480))
  17. {
  18. }
  19. template <class Pixel>
  20. LDSDLRasterizer<Pixel>::~LDSDLRasterizer() = default;
  21. template <class Pixel>
  22. PostProcessor* LDSDLRasterizer<Pixel>::getPostProcessor() const
  23. {
  24. return postProcessor.get();
  25. }
  26. template <class Pixel>
  27. void LDSDLRasterizer<Pixel>::frameStart(EmuTime::param time)
  28. {
  29. workFrame = postProcessor->rotateFrames(std::move(workFrame), time);
  30. }
  31. template<class Pixel>
  32. void LDSDLRasterizer<Pixel>::drawBlank(int r, int g, int b)
  33. {
  34. // We should really be presenting the "LASERVISION" text
  35. // here, like the real laserdisc player does. Note that this
  36. // changes when seeking or starting to play.
  37. auto background = static_cast<Pixel>(workFrame->getPixelFormat().map(r, g, b));
  38. for (int y = 0; y < 480; ++y) {
  39. workFrame->setBlank(y, background);
  40. }
  41. }
  42. template<class Pixel>
  43. RawFrame* LDSDLRasterizer<Pixel>::getRawFrame()
  44. {
  45. return workFrame.get();
  46. }
  47. // Force template instantiation.
  48. #if HAVE_16BPP
  49. template class LDSDLRasterizer<uint16_t>;
  50. #endif
  51. #if HAVE_32BPP || COMPONENT_GL
  52. template class LDSDLRasterizer<uint32_t>;
  53. #endif
  54. } // namespace openmsx