diff options
author | bunnei <bunneidev@gmail.com> | 2023-02-19 08:31:39 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:31 +0200 |
commit | ae099d583cf93175fe54359ea2b7c5b665398c8b (patch) | |
tree | aa9d91cdf741cc159fa2aba7a0c00f1efbf69eb3 /src/core/frontend/emu_window.h | |
parent | common: dynamic_library: Add ctor for existing handle. (diff) | |
download | yuzu-ae099d583cf93175fe54359ea2b7c5b665398c8b.tar yuzu-ae099d583cf93175fe54359ea2b7c5b665398c8b.tar.gz yuzu-ae099d583cf93175fe54359ea2b7c5b665398c8b.tar.bz2 yuzu-ae099d583cf93175fe54359ea2b7c5b665398c8b.tar.lz yuzu-ae099d583cf93175fe54359ea2b7c5b665398c8b.tar.xz yuzu-ae099d583cf93175fe54359ea2b7c5b665398c8b.tar.zst yuzu-ae099d583cf93175fe54359ea2b7c5b665398c8b.zip |
Diffstat (limited to 'src/core/frontend/emu_window.h')
-rw-r--r-- | src/core/frontend/emu_window.h | 48 |
1 files changed, 3 insertions, 45 deletions
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h index 1093800f6..a72df034e 100644 --- a/src/core/frontend/emu_window.h +++ b/src/core/frontend/emu_window.h @@ -5,11 +5,14 @@ #include <memory> #include <utility> + #include "common/common_types.h" #include "core/frontend/framebuffer_layout.h" namespace Core::Frontend { +class GraphicsContext; + /// Information for the Graphics Backends signifying what type of screen pointer is in /// WindowInformation enum class WindowSystemType { @@ -22,51 +25,6 @@ enum class WindowSystemType { }; /** - * Represents a drawing context that supports graphics operations. - */ -class GraphicsContext { -public: - virtual ~GraphicsContext(); - - /// Inform the driver to swap the front/back buffers and present the current image - virtual void SwapBuffers() {} - - /// Makes the graphics context current for the caller thread - virtual void MakeCurrent() {} - - /// Releases (dunno if this is the "right" word) the context from the caller thread - virtual void DoneCurrent() {} - - class Scoped { - public: - [[nodiscard]] explicit Scoped(GraphicsContext& context_) : context(context_) { - context.MakeCurrent(); - } - ~Scoped() { - if (active) { - context.DoneCurrent(); - } - } - - /// In the event that context was destroyed before the Scoped is destroyed, this provides a - /// mechanism to prevent calling a destroyed object's method during the deconstructor - void Cancel() { - active = false; - } - - private: - GraphicsContext& context; - bool active{true}; - }; - - /// Calls MakeCurrent on the context and calls DoneCurrent when the scope for the returned value - /// ends - [[nodiscard]] Scoped Acquire() { - return Scoped{*this}; - } -}; - -/** * Abstraction class used to provide an interface between emulation code and the frontend * (e.g. SDL, QGLWidget, GLFW, etc...). * |