openMSX
RawFrame.hh
Go to the documentation of this file.
1 #ifndef RAWFRAME_HH
2 #define RAWFRAME_HH
3 
4 #include "FrameSource.hh"
5 #include "MemBuffer.hh"
6 #include "openmsx.hh"
7 #include <cassert>
8 
9 namespace openmsx {
10 
11 // Used by SDLRasterizer to implement left/right border drawing optimization.
13 {
14  uint32_t color0, color1;
15  byte mode = 0xff; // invalid mode
16  byte adjust;
17  byte scroll;
18  bool masked;
19 };
20 
21 
25 class RawFrame final : public FrameSource
26 {
27 public:
28  RawFrame(const PixelFormat& format, unsigned maxWidth, unsigned height);
29 
30  template<typename Pixel>
31  Pixel* getLinePtrDirect(unsigned y) {
32  return reinterpret_cast<Pixel*>(data.data() + y * pitch);
33  }
34 
35  unsigned getLineWidthDirect(unsigned y) const {
36  return lineWidths[y];
37  }
38 
39  inline void setLineWidth(unsigned line, unsigned width) {
40  assert(line < getHeight());
41  assert(width <= maxWidth);
42  lineWidths[line] = width;
43  }
44 
45  template <class Pixel>
46  inline void setBlank(unsigned line, Pixel color) {
47  assert(line < getHeight());
48  auto* pixels = getLinePtrDirect<Pixel>(line);
49  pixels[0] = color;
50  lineWidths[line] = 1;
51  }
52 
53  unsigned getRowLength() const override;
54 
55  // RawFrame is mostly agnostic of the border info struct. The only
56  // thing it does is store the information and give access to it.
57  V9958RasterizerBorderInfo& getBorderInfo() { return borderInfo; }
58 
59 protected:
60  unsigned getLineWidth(unsigned line) const override;
61  const void* getLineInfo(
62  unsigned line, unsigned& width,
63  void* buf, unsigned bufWidth) const override;
64  bool hasContiguousStorage() const override;
65 
66 private:
68  MemBuffer<unsigned> lineWidths;
69  unsigned maxWidth;
70  unsigned pitch;
71 
72  V9958RasterizerBorderInfo borderInfo;
73 };
74 
75 } // namespace openmsx
76 
77 #endif
openmsx.hh
openmsx::DiskImageUtils::format
void format(SectorAccessibleDisk &disk, bool dos1)
Format the given disk (= a single partition).
Definition: DiskImageUtils.cc:182
openmsx::V9958RasterizerBorderInfo::mode
byte mode
Definition: RawFrame.hh:15
openmsx::V9958RasterizerBorderInfo::masked
bool masked
Definition: RawFrame.hh:18
FrameSource.hh
openmsx::RawFrame::getLineWidthDirect
unsigned getLineWidthDirect(unsigned y) const
Definition: RawFrame.hh:35
openmsx::V9958RasterizerBorderInfo
Definition: RawFrame.hh:13
openmsx::RawFrame::RawFrame
RawFrame(const PixelFormat &format, unsigned maxWidth, unsigned height)
Definition: RawFrame.cc:6
openmsx::PixelFormat
Definition: PixelFormat.hh:9
openmsx::RawFrame::getLineInfo
const void * getLineInfo(unsigned line, unsigned &width, void *buf, unsigned bufWidth) const override
Abstract implementation of getLinePtr().
Definition: RawFrame.cc:40
openmsx::Pixel
uint32_t Pixel
Definition: GLHQLiteScaler.cc:98
openmsx::MemBuffer< char, 64 >
openmsx::RawFrame::hasContiguousStorage
bool hasContiguousStorage() const override
Returns true when two consecutive rows are also consecutive in memory.
Definition: RawFrame.cc:54
openmsx::RawFrame
A video frame as output by the VDP scanline conversion unit, before any postprocessing filters are ap...
Definition: RawFrame.hh:26
MemBuffer.hh
openmsx::V9958RasterizerBorderInfo::adjust
byte adjust
Definition: RawFrame.hh:16
openmsx::FrameSource::getHeight
unsigned getHeight() const
Gets the number of lines in this frame.
Definition: FrameSource.hh:43
openmsx::RawFrame::setLineWidth
void setLineWidth(unsigned line, unsigned width)
Definition: RawFrame.hh:39
openmsx::V9958RasterizerBorderInfo::color1
uint32_t color1
Definition: RawFrame.hh:14
openmsx::RawFrame::getBorderInfo
V9958RasterizerBorderInfo & getBorderInfo()
Definition: RawFrame.hh:57
openmsx::RawFrame::getLinePtrDirect
Pixel * getLinePtrDirect(unsigned y)
Definition: RawFrame.hh:31
openmsx::FrameSource
Interface for getting lines from a video frame.
Definition: FrameSource.hh:14
openmsx::V9958RasterizerBorderInfo::color0
uint32_t color0
Definition: RawFrame.hh:14
openmsx::MemBuffer::data
const T * data() const
Returns pointer to the start of the memory buffer.
Definition: MemBuffer.hh:81
openmsx::RawFrame::getRowLength
unsigned getRowLength() const override
Returns the distance (in pixels) between two consecutive lines.
Definition: RawFrame.cc:49
openmsx::RawFrame::getLineWidth
unsigned getLineWidth(unsigned line) const override
Gets the number of display pixels on the given line.
Definition: RawFrame.cc:34
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::V9958RasterizerBorderInfo::scroll
byte scroll
Definition: RawFrame.hh:17
openmsx::RawFrame::setBlank
void setBlank(unsigned line, Pixel color)
Definition: RawFrame.hh:46