Make VideoDriver::GetAnimBuffer a non-virtual/inlinable function
This commit is contained in:
@@ -17,13 +17,12 @@
|
|||||||
class VideoDriver_CocoaOpenGL : public VideoDriver_Cocoa {
|
class VideoDriver_CocoaOpenGL : public VideoDriver_Cocoa {
|
||||||
CGLContextObj gl_context;
|
CGLContextObj gl_context;
|
||||||
|
|
||||||
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
|
||||||
std::string driver_info; ///< Information string about selected driver.
|
std::string driver_info; ///< Information string about selected driver.
|
||||||
|
|
||||||
const char *AllocateContext(bool allow_software);
|
const char *AllocateContext(bool allow_software);
|
||||||
|
|
||||||
public:
|
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 ¶m) override;
|
const char *Start(const StringList ¶m) override;
|
||||||
void Stop() override;
|
void Stop() override;
|
||||||
@@ -37,7 +36,6 @@ public:
|
|||||||
void PopulateSystemSprites() override;
|
void PopulateSystemSprites() override;
|
||||||
|
|
||||||
bool HasAnimBuffer() override { return true; }
|
bool HasAnimBuffer() override { return true; }
|
||||||
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
|
|
||||||
|
|
||||||
/** Return driver name */
|
/** Return driver name */
|
||||||
const char *GetName() const override { return "cocoa-opengl"; }
|
const char *GetName() const override { return "cocoa-opengl"; }
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
/** The OpenGL video driver for windows. */
|
/** The OpenGL video driver for windows. */
|
||||||
class VideoDriver_SDL_OpenGL : public VideoDriver_SDL_Base {
|
class VideoDriver_SDL_OpenGL : public VideoDriver_SDL_Base {
|
||||||
public:
|
public:
|
||||||
VideoDriver_SDL_OpenGL() : gl_context(nullptr), anim_buffer(nullptr) {}
|
VideoDriver_SDL_OpenGL() : gl_context(nullptr) {}
|
||||||
|
|
||||||
const char *Start(const StringList ¶m) override;
|
const char *Start(const StringList ¶m) override;
|
||||||
|
|
||||||
@@ -27,7 +27,6 @@ public:
|
|||||||
void PopulateSystemSprites() override;
|
void PopulateSystemSprites() override;
|
||||||
|
|
||||||
bool HasAnimBuffer() override { return true; }
|
bool HasAnimBuffer() override { return true; }
|
||||||
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
|
|
||||||
|
|
||||||
void ToggleVsync(bool vsync) override;
|
void ToggleVsync(bool vsync) override;
|
||||||
|
|
||||||
@@ -42,7 +41,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void *gl_context; ///< OpenGL context.
|
void *gl_context; ///< OpenGL context.
|
||||||
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
|
||||||
|
|
||||||
const char *AllocateContext();
|
const char *AllocateContext();
|
||||||
void DestroyContext();
|
void DestroyContext();
|
||||||
|
|||||||
@@ -147,9 +147,9 @@ public:
|
|||||||
* Get a pointer to the animation buffer of the video back-end.
|
* 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.
|
* @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::recursive_mutex game_state_mutex;
|
||||||
std::mutex game_thread_wait_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);
|
static void GameThreadThunk(VideoDriver *drv);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public:
|
|||||||
/** The OpenGL video driver for windows. */
|
/** The OpenGL video driver for windows. */
|
||||||
class VideoDriver_Win32OpenGL : public VideoDriver_Win32Base {
|
class VideoDriver_Win32OpenGL : public VideoDriver_Win32Base {
|
||||||
public:
|
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 ¶m) override;
|
const char *Start(const StringList ¶m) override;
|
||||||
|
|
||||||
@@ -141,7 +141,6 @@ public:
|
|||||||
void ClearSystemSprites() override;
|
void ClearSystemSprites() override;
|
||||||
|
|
||||||
bool HasAnimBuffer() override { return true; }
|
bool HasAnimBuffer() override { return true; }
|
||||||
uint8 *GetAnimBuffer() override { return this->anim_buffer; }
|
|
||||||
|
|
||||||
void ToggleVsync(bool vsync) override;
|
void ToggleVsync(bool vsync) override;
|
||||||
|
|
||||||
@@ -152,7 +151,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
HDC dc; ///< Window device context.
|
HDC dc; ///< Window device context.
|
||||||
HGLRC gl_rc; ///< OpenGL context.
|
HGLRC gl_rc; ///< OpenGL context.
|
||||||
uint8 *anim_buffer; ///< Animation buffer from OpenGL back-end.
|
|
||||||
std::string driver_info; ///< Information string about selected driver.
|
std::string driver_info; ///< Information string about selected driver.
|
||||||
|
|
||||||
uint8 GetFullscreenBpp() override { return 32; } // OpenGL is always 32 bpp.
|
uint8 GetFullscreenBpp() override { return 32; } // OpenGL is always 32 bpp.
|
||||||
|
|||||||
Reference in New Issue
Block a user