Codechange: [Win32] Split the video driver into a base class and a GDI backend class.

This commit is contained in:
Michael Lutz
2021-01-16 16:42:59 +01:00
parent 78d96dad2a
commit 59e0d9618b
2 changed files with 97 additions and 88 deletions

View File

@@ -12,13 +12,9 @@
#include "video_driver.hpp"
/** The video driver for windows. */
class VideoDriver_Win32 : public VideoDriver {
/** Base class for Windows video drivers. */
class VideoDriver_Win32Base : public VideoDriver {
public:
const char *Start(const StringList &param) override;
void Stop() override;
void MakeDirty(int left, int top, int width, int height) override;
void MainLoop() override;
@@ -27,8 +23,6 @@ public:
bool ToggleFullscreen(bool fullscreen) override;
bool AfterBlitterChange() override;
void AcquireBlitterLock() override;
void ReleaseBlitterLock() override;
@@ -37,10 +31,6 @@ public:
void EditBoxLostFocus() override;
const char *GetName() const override { return "win32"; }
bool MakeWindow(bool full_screen);
protected:
Dimension GetScreenSize() const override;
float GetDPIScale() override;
@@ -51,17 +41,32 @@ protected:
void PaintThread() override;
void CheckPaletteAnim() override;
bool MakeWindow(bool full_screen);
private:
std::unique_lock<std::recursive_mutex> draw_lock;
static void PaintThreadThunk(VideoDriver_Win32 *drv);
static void PaintThreadThunk(VideoDriver_Win32Base *drv);
friend LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
};
/** The GDI video driver for windows. */
class VideoDriver_Win32GDI : public VideoDriver_Win32Base {
public:
const char *Start(const StringList &param) override;
void Stop() override;
bool AfterBlitterChange() override;
const char *GetName() const override { return "win32"; }
};
/** The factory for Windows' video driver. */
class FVideoDriver_Win32 : public DriverFactoryBase {
class FVideoDriver_Win32GDI : public DriverFactoryBase {
public:
FVideoDriver_Win32() : DriverFactoryBase(Driver::DT_VIDEO, 10, "win32", "Win32 GDI Video Driver") {}
Driver *CreateInstance() const override { return new VideoDriver_Win32(); }
FVideoDriver_Win32GDI() : DriverFactoryBase(Driver::DT_VIDEO, 10, "win32", "Win32 GDI Video Driver") {}
Driver *CreateInstance() const override { return new VideoDriver_Win32GDI(); }
};
#endif /* VIDEO_WIN32_H */