OXYGENHUB
◆ main openmsx / src / video / scalers / GLScalerFactory.cc
1015 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "GLScalerFactory.hh"
2
3
#include "GLContext.hh"
4
#include "GLHQScaler.hh"
5
#include "GLRGBScaler.hh"
6
#include "GLScaleNxScaler.hh"
7
#include "GLSimpleScaler.hh"
8
#include "GLTVScaler.hh"
9
#include "RenderSettings.hh"
10
11
#include "unreachable.hh"
12
13
#include <memory>
14
15
namespace openmsx::GLScalerFactory {
16
17
std::unique_ptr<GLScaler> createScaler(
18
	RenderSettings& renderSettings, unsigned maxWidth, unsigned maxHeight)
19
{
20
	GLScaler& fallback = gl::context->getFallbackScaler();
21
	switch (renderSettings.getScaleAlgorithm()) {
22
	using enum RenderSettings::ScaleAlgorithm;
23
	case SIMPLE:
24
		return std::make_unique<GLSimpleScaler>(renderSettings, fallback);
25
	case RGBTRIPLET:
26
		return std::make_unique<GLRGBScaler>(renderSettings, fallback);
27
	case SCALE:
28
		return std::make_unique<GLScaleNxScaler>(fallback);
29
	case TV:
30
		return std::make_unique<GLTVScaler>(renderSettings);
31
	case HQ:
32
		return std::make_unique<GLHQScaler>(fallback, maxWidth, maxHeight);
33
	default:
34
		UNREACHABLE;
35
	}
36
}
37
38
} // namespace openmsx::GLScalerFactory