openMSX
DoubledFrame.cc
Go to the documentation of this file.
1 #include "DoubledFrame.hh"
2 #include <cstdint>
3 
4 namespace openmsx {
5 
6 DoubledFrame::DoubledFrame(const SDL_PixelFormat& format)
7  : FrameSource(format)
8 {
9 }
10 
11 void DoubledFrame::init(FrameSource* field_, unsigned skip_)
12 {
14  field = field_;
15  skip = skip_;
16  setHeight(2 * field->getHeight());
17 }
18 
19 unsigned DoubledFrame::getLineWidth(unsigned line) const
20 {
21  int t = line - skip;
22  return (t >= 0) ? field->getLineWidth(t / 2) : 1;
23 }
24 
25 const void* DoubledFrame::getLineInfo(
26  unsigned line, unsigned& width, void* buf, unsigned bufWidth) const
27 {
28  static const uint32_t blackPixel = 0; // both 16bppp and 32bpp
29  int t = line - skip;
30  if (t >= 0) {
31  return field->getLineInfo(t / 2, width, buf, bufWidth);
32  } else {
33  width = 1;
34  return &blackPixel;
35  }
36 }
37 
38 } // namespace openmsx
void init(FieldType fieldType_)
(Re)initialize an existing FrameSource.
Definition: FrameSource.hh:35
DoubledFrame(const SDL_PixelFormat &format)
Definition: DoubledFrame.cc:6
Interface for getting lines from a video frame.
Definition: FrameSource.hh:15
void init(FrameSource *field, unsigned skip)
Definition: DoubledFrame.cc:11
Interlacing is off for this frame.
Definition: FrameSource.hh:23
unsigned getHeight() const
Gets the number of lines in this frame.
Definition: FrameSource.hh:45
void setHeight(unsigned height_)
Definition: FrameSource.hh:201
virtual const void * getLineInfo(unsigned line, unsigned &lineWidth, void *buf, unsigned bufWidth) const =0
Abstract implementation of getLinePtr().
virtual unsigned getLineWidth(unsigned line) const =0
Gets the number of display pixels on the given line.