android: core: frontend: Port yuzu's code for scope acquire window context.

This commit is contained in:
bunnei 2019-10-01 23:48:06 -04:00 committed by xperia64
parent 18181ab361
commit deb9349e06
3 changed files with 42 additions and 1 deletions

View File

@ -108,8 +108,8 @@ add_library(core STATIC
frontend/framebuffer_layout.h
frontend/image_interface.h
frontend/input.h
frontend/mic.h
frontend/mic.cpp
frontend/mic.h
frontend/scope_acquire_context.cpp
frontend/scope_acquire_context.h
gdbstub/gdbstub.cpp

View File

@ -0,0 +1,18 @@
// Copyright 2019 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/frontend/emu_window.h"
#include "core/frontend/scope_acquire_window_context.h"
namespace Frontend {
ScopeAcquireWindowContext::ScopeAcquireWindowContext(Frontend::EmuWindow& emu_window_)
: emu_window{emu_window_} {
emu_window.MakeCurrent();
}
ScopeAcquireWindowContext::~ScopeAcquireWindowContext() {
emu_window.DoneCurrent();
}
} // namespace Frontend

View File

@ -0,0 +1,23 @@
// Copyright 2019 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#pragma once
#include "common/common_types.h"
namespace Frontend {
class EmuWindow;
/// Helper class to acquire/release window context within a given scope
class ScopeAcquireWindowContext : NonCopyable {
public:
explicit ScopeAcquireWindowContext(Frontend::EmuWindow& window);
~ScopeAcquireWindowContext();
private:
Frontend::EmuWindow& emu_window;
};
} // namespace Frontend