openMSX
V9990PixelRenderer.hh
Go to the documentation of this file.
1 #ifndef V9990PIXELRENDERER_HH
2 #define V9990PIXELRENDERER_HH
3 
4 #include "V9990Renderer.hh"
5 #include "Observer.hh"
6 #include "RenderSettings.hh"
7 #include "openmsx.hh"
8 #include <memory>
9 
10 namespace openmsx {
11 
12 class V9990;
13 class V9990Rasterizer;
14 class Setting;
15 class EventDistributor;
16 class RealTime;
17 class VideoSourceSetting;
18 
24 class V9990PixelRenderer final : public V9990Renderer
25  , private Observer<Setting>
26 {
27 public:
28  explicit V9990PixelRenderer(V9990& vdp);
29  ~V9990PixelRenderer() override;
30 
31  // V9990Renderer interface:
32  PostProcessor* getPostProcessor() const override;
33  void reset(EmuTime::param time) override;
34  void frameStart(EmuTime::param time) override;
35  void frameEnd(EmuTime::param time) override;
36  void updateDisplayEnabled(bool enabled, EmuTime::param time) override;
37  void setDisplayMode(V9990DisplayMode mode, EmuTime::param time) override;
38  void setColorMode(V9990ColorMode mode, EmuTime::param time) override;
39  void updatePalette(int index, byte r, byte g, byte b, bool ys,
40  EmuTime::param time) override;
41  void updateSuperimposing(bool enabled, EmuTime::param time) override;
42  void updateBackgroundColor(int index, EmuTime::param time) override;
43  void updateScrollAX(EmuTime::param time) override;
44  void updateScrollBX(EmuTime::param time) override;
45  void updateScrollAYLow(EmuTime::param time) override;
46  void updateScrollBYLow(EmuTime::param time) override;
47 
48 private:
49  void sync(EmuTime::param time, bool force = false);
50  void renderUntil(EmuTime::param time) override;
51 
54  enum DrawType {
55  DRAW_BORDER,
56  DRAW_DISPLAY
57  };
58 
61  V9990& vdp;
62 
63  EventDistributor& eventDistributor;
64  RealTime& realTime;
65 
68  RenderSettings& renderSettings;
69  VideoSourceSetting& videoSourceSetting;
70 
73  const std::unique_ptr<V9990Rasterizer> rasterizer;
74 
77  float finishFrameDuration;
78  int frameSkipCounter;
79 
82  RenderSettings::Accuracy accuracy;
83 
87  int lastY;
88 
92  int lastX;
93 
103  int verticalOffsetA;
104  int verticalOffsetB;
105 
110  bool displayEnabled;
111 
114  bool drawFrame;
115  bool prevDrawFrame;
116 
119  void draw(int fromX, int fromY, int toX, int toY, DrawType type);
120 
124  void subdivide(int fromX, int fromY, int toX, int toY,
125  int clipL, int clipR, DrawType drawType);
126 
127  // Observer<Setting>
128  void update(const Setting& setting) override;
129 };
130 
131 } // namespace openmsx
132 
133 #endif
openmsx::VideoSourceSetting
Definition: VideoSourceSetting.hh:10
openmsx.hh
openmsx::V9990PixelRenderer::getPostProcessor
PostProcessor * getPostProcessor() const override
See V9990::getPostProcessor.
Definition: V9990PixelRenderer.cc:48
openmsx::RenderSettings
Class containing all settings for renderers.
Definition: RenderSettings.hh:21
openmsx::V9990PixelRenderer::~V9990PixelRenderer
~V9990PixelRenderer() override
Definition: V9990PixelRenderer.cc:42
openmsx::V9990PixelRenderer::setDisplayMode
void setDisplayMode(V9990DisplayMode mode, EmuTime::param time) override
Set screen mode.
Definition: V9990PixelRenderer.cc:256
V9990Renderer.hh
openmsx::V9990PixelRenderer::updateBackgroundColor
void updateBackgroundColor(int index, EmuTime::param time) override
Set background color.
Definition: V9990PixelRenderer.cc:284
openmsx::V9990PixelRenderer
Generic pixel based renderer for the V9990.
Definition: V9990PixelRenderer.hh:24
openmsx::V9990ColorMode
V9990ColorMode
Definition: V9990ModeEnum.hh:11
openmsx::Setting
Definition: Setting.hh:119
openmsx::RenderSettings::Accuracy
Accuracy
Render accuracy: granularity of the rendered area.
Definition: RenderSettings.hh:32
openmsx::EventDistributor
Definition: EventDistributor.hh:16
openmsx::V9990PixelRenderer::updateScrollBX
void updateScrollBX(EmuTime::param time) override
Definition: V9990PixelRenderer.cc:293
openmsx::V9990PixelRenderer::frameStart
void frameStart(EmuTime::param time) override
Signal the start of a new frame.
Definition: V9990PixelRenderer.cc:62
openmsx::V9990PixelRenderer::updatePalette
void updatePalette(int index, byte r, byte g, byte b, bool ys, EmuTime::param time) override
Set a palette entry.
Definition: V9990PixelRenderer.cc:262
openmsx::V9990
V9990
Definition: V9990.cc:974
Observer.hh
openmsx::V9990PixelRenderer::V9990PixelRenderer
V9990PixelRenderer(V9990 &vdp)
Definition: V9990PixelRenderer.cc:22
openmsx::V9990PixelRenderer::updateDisplayEnabled
void updateDisplayEnabled(bool enabled, EmuTime::param time) override
Informs the renderer of a VDP display enabled change.
Definition: V9990PixelRenderer.cc:250
openmsx::V9990DisplayMode
V9990DisplayMode
Definition: V9990ModeEnum.hh:6
openmsx::PostProcessor
Abstract base class for post processors.
Definition: PostProcessor.hh:29
RenderSettings.hh
openmsx::RealTime
Definition: RealTime.hh:21
openmsx::V9990PixelRenderer::updateSuperimposing
void updateSuperimposing(bool enabled, EmuTime::param time) override
Change superimpose status.
Definition: V9990PixelRenderer.cc:273
g
int g
Definition: ScopedAssign_test.cc:20
openmsx::V9990PixelRenderer::frameEnd
void frameEnd(EmuTime::param time) override
Signal the end of the current frame.
Definition: V9990PixelRenderer.cc:106
openmsx::V9990PixelRenderer::updateScrollAYLow
void updateScrollAYLow(EmuTime::param time) override
Definition: V9990PixelRenderer.cc:298
openmsx::V9990PixelRenderer::setColorMode
void setColorMode(V9990ColorMode mode, EmuTime::param time) override
Set color mode.
Definition: V9990PixelRenderer.cc:278
openmsx::V9990PixelRenderer::updateScrollBYLow
void updateScrollBYLow(EmuTime::param time) override
Definition: V9990PixelRenderer.cc:307
openmsx::V9990PixelRenderer::updateScrollAX
void updateScrollAX(EmuTime::param time) override
Set scroll register.
Definition: V9990PixelRenderer.cc:289
openmsx::V9990PixelRenderer::reset
void reset(EmuTime::param time) override
Re-initialise the V9990Renderer's state.
Definition: V9990PixelRenderer.cc:53
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::Observer
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:9
openmsx::V9990Renderer
Abstract base class for V9990 renderers.
Definition: V9990Renderer.hh:18
openmsx::V9990
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.
Definition: V9990.hh:29