openMSX
DoubledFrame.cc
Go to the documentation of this file.
1 #include "DoubledFrame.hh"
2 
3 namespace openmsx {
4 
5 DoubledFrame::DoubledFrame(const SDL_PixelFormat& format)
6  : FrameSource(format)
7 {
8 }
9 
10 void DoubledFrame::init(FrameSource* field_, unsigned skip_)
11 {
13  field = field_;
14  skip = skip_;
15  setHeight(2 * field->getHeight());
16 }
17 
18 unsigned DoubledFrame::getLineWidth(unsigned line) const
19 {
20  int t = line - skip;
21  return (t >= 0) ? field->getLineWidth(t / 2) : 1;
22 }
23 
24 const void* DoubledFrame::getLineInfo(unsigned line, unsigned& width) const
25 {
26  static const unsigned blackPixel = 0; // both 16bppp and 32bpp
27  int t = line - skip;
28  if (t >= 0) {
29  return field->getLineInfo(t / 2, width);
30  } else {
31  width = 1;
32  return &blackPixel;
33  }
34 }
35 
36 } // namespace openmsx