Make VideoDriver::GetAnimBuffer a non-virtual/inlinable function

pull/590/head
Jonathan G Rennison 10 months ago
parent 6fff633e81
commit 95f3cf2a8e

@ -17,13 +17,12 @@
class VideoDriver_CocoaOpenGL : public VideoDriver_Cocoa {
CGLContextObj gl_context;
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
std::string driver_info; ///< Information string about selected driver.
const char *AllocateContext(bool allow_software);
public:
VideoDriver_CocoaOpenGL() : gl_context(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {}
VideoDriver_CocoaOpenGL() : gl_context(nullptr), driver_info(this->GetName()) {}
const char *Start(const StringList &param) override;
void Stop() override;
@ -37,7 +36,6 @@ public:
void PopulateSystemSprites() override;
bool HasAnimBuffer() override { return true; }
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
/** Return driver name */
const char *GetName() const override { return "cocoa-opengl"; }

@ -12,7 +12,7 @@
/** The OpenGL video driver for windows. */
class VideoDriver_SDL_OpenGL : public VideoDriver_SDL_Base {
public:
VideoDriver_SDL_OpenGL() : gl_context(nullptr), anim_buffer(nullptr) {}
VideoDriver_SDL_OpenGL() : gl_context(nullptr) {}
const char *Start(const StringList &param) override;
@ -27,7 +27,6 @@ public:
void PopulateSystemSprites() override;
bool HasAnimBuffer() override { return true; }
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
void ToggleVsync(bool vsync) override;
@ -42,7 +41,6 @@ protected:
private:
void *gl_context; ///< OpenGL context.
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
const char *AllocateContext();
void DestroyContext();

@ -147,9 +147,9 @@ public:
* Get a pointer to the animation buffer of the video back-end.
* @return Pointer to the buffer or nullptr if no animation buffer is supported.
*/
virtual uint8 *GetAnimBuffer()
inline uint8 *GetAnimBuffer()
{
return nullptr;
return this->anim_buffer;
}
/**
@ -362,6 +362,8 @@ protected:
std::recursive_mutex game_state_mutex;
std::mutex game_thread_wait_mutex;
uint8 *anim_buffer = nullptr; ///< Animation buffer, (not used by all drivers, here because it is accessed very frequently)
static void GameThreadThunk(VideoDriver *drv);
private:

@ -122,7 +122,7 @@ public:
/** The OpenGL video driver for windows. */
class VideoDriver_Win32OpenGL : public VideoDriver_Win32Base {
public:
VideoDriver_Win32OpenGL() : dc(nullptr), gl_rc(nullptr), anim_buffer(nullptr), driver_info(this->GetName()) {}
VideoDriver_Win32OpenGL() : dc(nullptr), gl_rc(nullptr), driver_info(this->GetName()) {}
const char *Start(const StringList &param) override;
@ -141,7 +141,6 @@ public:
void ClearSystemSprites() override;
bool HasAnimBuffer() override { return true; }
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
void ToggleVsync(bool vsync) override;
@ -152,7 +151,6 @@ public:
protected:
HDC dc; ///< Window device context.
HGLRC gl_rc; ///< OpenGL context.
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
std::string driver_info; ///< Information string about selected driver.
uint8 GetFullscreenBpp() override { return 32; } // OpenGL is always 32 bpp.

Loading…
Cancel
Save