[glfw] Atomic is no longer needed
All View events come from the same thread.
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
class GLFWView : public mbgl::View {
|
||||
public:
|
||||
GLFWView(bool fullscreen = false, bool benchmark = false);
|
||||
@@ -95,7 +93,7 @@ private:
|
||||
mbgl::util::Timer frameTick;
|
||||
|
||||
GLFWwindow *window = nullptr;
|
||||
std::atomic_flag clean = ATOMIC_FLAG_INIT;
|
||||
bool dirty = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -417,15 +417,12 @@ void GLFWView::onMouseMove(GLFWwindow *window, double x, double y) {
|
||||
void GLFWView::run() {
|
||||
auto callback = [&] {
|
||||
if (glfwWindowShouldClose(window)) {
|
||||
frameTick.stop();
|
||||
runLoop.stop();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
glfwPollEvents();
|
||||
|
||||
const bool dirty = !clean.test_and_set();
|
||||
if (dirty) {
|
||||
const double started = glfwGetTime();
|
||||
|
||||
@@ -444,6 +441,8 @@ void GLFWView::run() {
|
||||
if (benchmark) {
|
||||
map->update(mbgl::Update::Repaint);
|
||||
}
|
||||
|
||||
dirty = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -476,7 +475,7 @@ void GLFWView::deactivate() {
|
||||
}
|
||||
|
||||
void GLFWView::invalidate() {
|
||||
clean.clear();
|
||||
dirty = true;
|
||||
glfwPostEmptyEvent();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user