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  [[nodiscard]] 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  void draw(int fromX, int fromY, int toX, int toY, DrawType type);
62 
66  void subdivide(int fromX, int fromY, int toX, int toY,
67  int clipL, int clipR, DrawType drawType);
68 
69  // Observer<Setting>
70  void update(const Setting& setting) noexcept override;
71 
72 private:
75  V9990& vdp;
76 
77  EventDistributor& eventDistributor;
78  RealTime& realTime;
79 
82  RenderSettings& renderSettings;
83  VideoSourceSetting& videoSourceSetting;
84 
87  const std::unique_ptr<V9990Rasterizer> rasterizer;
88 
91  float finishFrameDuration;
92  int frameSkipCounter;
93 
96  RenderSettings::Accuracy accuracy;
97 
101  int lastY;
102 
106  int lastX;
107 
117  int verticalOffsetA;
118  int verticalOffsetB;
119 
124  bool displayEnabled;
125 
128  bool drawFrame;
129  bool prevDrawFrame;
130 };
131 
132 } // namespace openmsx
133 
134 #endif
BaseSetting * setting
Definition: Interpreter.cc:27
int g
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:10
Abstract base class for post processors.
Class containing all settings for renderers.
Accuracy
Render accuracy: granularity of the rendered area.
Generic pixel based renderer for the V9990.
void updateScrollBX(EmuTime::param time) override
void updatePalette(int index, byte r, byte g, byte b, bool ys, EmuTime::param time) override
Set a palette entry.
void setDisplayMode(V9990DisplayMode mode, EmuTime::param time) override
Set screen mode.
void updateScrollAYLow(EmuTime::param time) override
void reset(EmuTime::param time) override
Re-initialise the V9990Renderer's state.
void updateScrollAX(EmuTime::param time) override
Set scroll register.
void updateSuperimposing(bool enabled, EmuTime::param time) override
Change superimpose status.
PostProcessor * getPostProcessor() const override
See V9990::getPostProcessor.
void updateScrollBYLow(EmuTime::param time) override
void frameEnd(EmuTime::param time) override
Signal the end of the current frame.
void updateBackgroundColor(int index, EmuTime::param time) override
Set background color.
void updateDisplayEnabled(bool enabled, EmuTime::param time) override
Informs the renderer of a VDP display enabled change.
void frameStart(EmuTime::param time) override
Signal the start of a new frame.
void setColorMode(V9990ColorMode mode, EmuTime::param time) override
Set color mode.
Abstract base class for V9990 renderers.
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.
Definition: V9990.hh:32
This file implemented 3 utility functions:
Definition: Autofire.cc:9