|
@@ -46,52 +46,56 @@ protected:
|
|
|
bool LockVideoBuffer() override;
|
|
|
void UnlockVideoBuffer() override;
|
|
|
void CheckPaletteAnim() override;
|
|
|
|
|
|
void Initialize();
|
|
|
bool MakeWindow(bool full_screen);
|
|
|
void ClientSizeChanged(int w, int h);
|
|
|
|
|
|
/** Get screen depth to use for fullscreen mode. */
|
|
|
virtual uint8 GetFullscreenBpp();
|
|
|
/** (Re-)create the backing store. */
|
|
|
virtual bool AllocateBackingStore(int w, int h, bool force = false) = 0;
|
|
|
/** Get a pointer to the video buffer. */
|
|
|
virtual void *GetVideoPointer() = 0;
|
|
|
/** Palette of the window has changed. */
|
|
|
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. */
|
|
|
class VideoDriver_Win32GDI : public VideoDriver_Win32Base {
|
|
|
public:
|
|
|
VideoDriver_Win32GDI() : dib_sect(nullptr), gdi_palette(nullptr) {}
|
|
|
VideoDriver_Win32GDI() : dib_sect(nullptr), gdi_palette(nullptr), buffer_bits(nullptr) {}
|
|
|
|
|
|
const char *Start(const StringList ¶m) override;
|
|
|
|
|
|
void Stop() override;
|
|
|
|
|
|
bool AfterBlitterChange() override;
|
|
|
|
|
|
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 *buffer_bits; ///< Internal rendering buffer.
|
|
|
|
|
|
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;
|
|
|
void MakePalette();
|
|
|
void UpdatePalette(HDC dc, uint start, uint count);
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
public:
|
|
|
static int RedrawScreenDebug();
|
|
|
#endif
|
|
|
};
|
|
@@ -121,24 +125,25 @@ public:
|
|
|
const char *GetName() const override { return "win32-opengl"; }
|
|
|
|
|
|
protected:
|
|
|
HDC dc; ///< Window device context.
|
|
|
HGLRC gl_rc; ///< OpenGL context.
|
|
|
|
|
|
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;
|
|
|
void PaletteChanged(HWND hWnd) override {}
|
|
|
|
|
|
const char *AllocateContext();
|
|
|
void DestroyContext();
|
|
|
};
|
|
|
|
|
|
/** The factory for Windows' OpenGL video driver. */
|
|
|
class FVideoDriver_Win32OpenGL : public DriverFactoryBase {
|
|
|
public:
|
|
|
FVideoDriver_Win32OpenGL() : DriverFactoryBase(Driver::DT_VIDEO, 9, "win32-opengl", "Win32 OpenGL Video Driver") {}
|
|
|
/* virtual */ Driver *CreateInstance() const override { return new VideoDriver_Win32OpenGL(); }
|
|
|
};
|