DoubledFrame.cc 807 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "DoubledFrame.hh"
  2. #include <cstdint>
  3. namespace openmsx {
  4. DoubledFrame::DoubledFrame(const PixelFormat& format)
  5. : FrameSource(format)
  6. {
  7. }
  8. void DoubledFrame::init(FrameSource* field_, unsigned skip_)
  9. {
  10. FrameSource::init(FIELD_NONINTERLACED);
  11. field = field_;
  12. skip = skip_;
  13. setHeight(2 * field->getHeight());
  14. }
  15. unsigned DoubledFrame::getLineWidth(unsigned line) const
  16. {
  17. int t = line - skip;
  18. return (t >= 0) ? field->getLineWidth(t / 2) : 1;
  19. }
  20. const void* DoubledFrame::getLineInfo(
  21. unsigned line, unsigned& width, void* buf, unsigned bufWidth) const
  22. {
  23. static constexpr uint32_t blackPixel = 0; // both 16bppp and 32bpp
  24. int t = line - skip;
  25. if (t >= 0) {
  26. return field->getLineInfo(t / 2, width, buf, bufWidth);
  27. } else {
  28. width = 1;
  29. return &blackPixel;
  30. }
  31. }
  32. } // namespace openmsx