Merge branch 'master' into jgrpp

This commit is contained in:
Jonathan G Rennison
2021-04-05 17:50:39 +01:00
164 changed files with 3493 additions and 2443 deletions

View File

@@ -21,7 +21,7 @@
/** Base class for Windows video drivers. */
class VideoDriver_Win32Base : public VideoDriver {
public:
VideoDriver_Win32Base() : main_wnd(nullptr), fullscreen(false), draw_mutex(nullptr), draw_signal(nullptr) {}
VideoDriver_Win32Base() : main_wnd(nullptr), fullscreen(false) {}
void Stop() override;
@@ -33,14 +33,12 @@ public:
bool ToggleFullscreen(bool fullscreen) override;
void AcquireBlitterLock() override;
void ReleaseBlitterLock() override;
bool ClaimMousePointer() override;
void EditBoxLostFocus() override;
std::vector<int> GetListOfMonitorRefreshRates() override;
protected:
HWND main_wnd; ///< Handle to system window.
bool fullscreen; ///< Whether to use (true) fullscreen mode.
@@ -51,12 +49,7 @@ protected:
int width_org = 0; ///< Original monitor resolution width, before we changed it.
int height_org = 0; ///< Original monitor resolution height, before we changed it.
bool draw_threaded; ///< Whether the drawing is/may be done in a separate thread.
bool buffer_locked; ///< Video buffer was locked by the main thread.
volatile bool draw_continue; ///< Should we keep continue drawing?
std::recursive_mutex *draw_mutex; ///< Mutex to keep the access to the shared memory controlled.
std::condition_variable_any *draw_signal; ///< Signal to draw the next frame.
bool buffer_locked; ///< Video buffer was locked by the main thread.
Dimension GetScreenSize() const override;
float GetDPIScale() override;
@@ -67,7 +60,7 @@ protected:
bool PollEvent() override;
void Initialize();
bool MakeWindow(bool full_screen);
bool MakeWindow(bool full_screen, bool resize = true);
void ClientSizeChanged(int w, int h, bool force = false);
/** Get screen depth to use for fullscreen mode. */
@@ -82,10 +75,6 @@ protected:
virtual void PaletteChanged(HWND hWnd) = 0;
private:
std::unique_lock<std::recursive_mutex> draw_lock;
static void PaintThreadThunk(VideoDriver_Win32Base *drv);
friend LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
};
/** The GDI video driver for windows. */
@@ -108,7 +97,6 @@ protected:
void Paint() override;
void *GetVideoPointer() override { return this->buffer_bits; }
void PaintThread() override;
bool AllocateBackingStore(int w, int h, bool force = false) override;
void PaletteChanged(HWND hWnd) override;
@@ -147,6 +135,8 @@ public:
bool UseSystemCursor() override { return true; }
void PopulateSystemSprites() override;
void ClearSystemSprites() override;
bool HasAnimBuffer() override { return true; }
@@ -163,7 +153,6 @@ protected:
uint8 GetFullscreenBpp() override { return 32; } // OpenGL is always 32 bpp.
void Paint() override;
void PaintThread() override {}
bool AllocateBackingStore(int w, int h, bool force = false) override;
void *GetVideoPointer() override;
@@ -179,6 +168,9 @@ class FVideoDriver_Win32OpenGL : public DriverFactoryBase {
public:
FVideoDriver_Win32OpenGL() : DriverFactoryBase(Driver::DT_VIDEO, 10, "win32-opengl", "Win32 OpenGL Video Driver") {}
/* virtual */ Driver *CreateInstance() const override { return new VideoDriver_Win32OpenGL(); }
protected:
bool UsesHardwareAcceleration() const override { return true; }
};
#endif /* WITH_OPENGL */