Codechange: [Win32] Move GDI-specific variables and related functions into the GDI video driver class.

This commit is contained in:
Michael Lutz
2021-01-16 16:43:02 +01:00
parent 8b90d4abe0
commit 78b8fc3e4f
2 changed files with 103 additions and 98 deletions

View File

@@ -15,6 +15,8 @@
/** Base class for Windows video drivers. */
class VideoDriver_Win32Base : public VideoDriver {
public:
VideoDriver_Win32Base() : main_wnd(nullptr) {}
void MakeDirty(int left, int top, int width, int height) override;
void MainLoop() override;
@@ -32,6 +34,8 @@ public:
void EditBoxLostFocus() override;
protected:
HWND main_wnd; ///< Handle to system window.
Dimension GetScreenSize() const override;
float GetDPIScale() override;
void InputLoop() override;
@@ -58,6 +62,8 @@ private:
/** The GDI video driver for windows. */
class VideoDriver_Win32GDI : public VideoDriver_Win32Base {
public:
VideoDriver_Win32GDI() : dib_sect(nullptr), gdi_palette(nullptr) {}
const char *Start(const StringList &param) override;
void Stop() override;
@@ -67,11 +73,21 @@ public:
const char *GetName() const override { return "win32"; }
protected:
HBITMAP dib_sect; ///< System bitmap object referencing our rendering buffer.
HPALETTE gdi_palette; ///< Palette object for 8bpp blitter.
void Paint() override;
void PaintThread() override;
bool AllocateBackingStore(int w, int h, bool force = false) override;
void PaletteChanged(HWND hWnd) override;
void MakePalette();
void UpdatePalette(HDC dc, uint start, uint count);
#ifdef _DEBUG
public:
static int RedrawScreenDebug();
#endif
};
/** The factory for Windows' video driver. */