openMSX
RenderSettings.hh
Go to the documentation of this file.
1 #ifndef RENDERSETTINGS_HH
2 #define RENDERSETTINGS_HH
3 
4 #include "RendererFactory.hh"
5 #include "Observer.hh"
6 #include "noncopyable.hh"
7 #include <string>
8 #include <memory>
9 
10 namespace openmsx {
11 
12 class CommandController;
13 class Setting;
14 class IntegerSetting;
15 class FloatSetting;
16 class BooleanSetting;
17 class StringSetting;
18 class VideoSourceSetting;
19 class ColorMatrixChecker;
20 
25 class RenderSettings : private Observer<Setting>, private noncopyable
26 {
27 public:
31 
37  };
38 
41  };
42 
43  explicit RenderSettings(CommandController& commandController);
45 
47  EnumSetting<Accuracy>& getAccuracy() const { return *accuracySetting; }
48 
50  BooleanSetting& getDeinterlace() const { return *deinterlaceSetting; }
51 
53  IntegerSetting& getMaxFrameSkip() const { return *maxFrameSkipSetting; }
54 
56  IntegerSetting& getMinFrameSkip() const { return *minFrameSkipSetting; }
57 
59  BooleanSetting& getFullScreen() const { return *fullScreenSetting; }
60 
62  FloatSetting& getGamma() const { return *gammaSetting; }
63 
65  FloatSetting& getBrightness() const { return *brightnessSetting; }
66 
68  FloatSetting& getContrast() const { return *contrastSetting; }
69 
71  StringSetting& getColorMatrix() const { return *colorMatrixSetting; }
72 
74  bool isColorMatrixIdentity() const { return cmIdentity; }
75 
77  IntegerSetting& getGlow() const { return *glowSetting; }
78 
80  FloatSetting& getNoise() const { return *noiseSetting; }
81 
83  int getBlurFactor() const;
84 
86  int getScanlineFactor() const;
87 
89  float getScanlineGap() const;
90 
93  return *rendererSetting;
94  }
95 
98  return *scaleAlgorithmSetting;
99  }
100 
102  IntegerSetting& getScaleFactor() const { return *scaleFactorSetting; }
103 
110  BooleanSetting& getLimitSprites() const { return *limitSpritesSetting; }
111 
113  BooleanSetting& getDisableSprites() const { return *disableSpritesSetting; }
114 
117  EnumSetting<bool>& getCmdTiming() const { return *cmdTimingSetting; }
118 
122  return *displayDeformSetting;
123  }
124 
130  return *horizontalStretchSetting;
131  }
132 
136  return *pointerHideDelaySetting;
137  }
138 
146  double transformComponent(double c) const;
147 
154  void transformRGB(double& r, double& g, double& b) const;
155 
156 private:
157  // Observer:
158  void update(const Setting&);
159 
163  void updateBrightnessAndContrast();
164 
165  void parseColorMatrix(const std::string& value);
166 
167  std::unique_ptr<EnumSetting<Accuracy>> accuracySetting;
168  std::unique_ptr<EnumSetting<bool>> cmdTimingSetting;
169  std::unique_ptr<BooleanSetting> deinterlaceSetting;
170  std::unique_ptr<BooleanSetting> fullScreenSetting;
171  std::unique_ptr<FloatSetting> gammaSetting;
172  std::unique_ptr<FloatSetting> brightnessSetting;
173  std::unique_ptr<FloatSetting> contrastSetting;
174  std::unique_ptr<ColorMatrixChecker> colorMatrixChecker;
175  std::unique_ptr<StringSetting> colorMatrixSetting;
176  std::unique_ptr<IntegerSetting> glowSetting;
177  std::unique_ptr<FloatSetting> noiseSetting;
178  std::unique_ptr<IntegerSetting> horizontalBlurSetting;
179  std::unique_ptr<BooleanSetting> limitSpritesSetting;
180  std::unique_ptr<BooleanSetting> disableSpritesSetting;
181  std::unique_ptr<IntegerSetting> maxFrameSkipSetting;
182  std::unique_ptr<IntegerSetting> minFrameSkipSetting;
183  std::unique_ptr<RendererFactory::RendererSetting> rendererSetting;
184  std::unique_ptr<EnumSetting<ScaleAlgorithm>> scaleAlgorithmSetting;
185  std::unique_ptr<IntegerSetting> scaleFactorSetting;
186  std::unique_ptr<IntegerSetting> scanlineAlphaSetting;
187  std::unique_ptr<EnumSetting<DisplayDeform>> displayDeformSetting;
188  std::unique_ptr<FloatSetting> horizontalStretchSetting;
189  std::unique_ptr<FloatSetting> pointerHideDelaySetting;
190 
191  double brightness;
192  double contrast;
193 
195  double cm[3][3];
197  bool cmIdentity;
198 
199  friend class ColorMatrixChecker;
200 };
201 
202 } // namespace openmsx
203 
204 #endif