forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gl_context_switch.cc
38 lines (25 loc) · 1.02 KB
/
gl_context_switch.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/common/graphics/gl_context_switch.h"
namespace flutter {
SwitchableGLContext::SwitchableGLContext() = default;
SwitchableGLContext::~SwitchableGLContext() = default;
GLContextResult::GLContextResult() = default;
GLContextResult::~GLContextResult() = default;
GLContextResult::GLContextResult(bool static_result) : result_(static_result){};
bool GLContextResult::GetResult() {
return result_;
};
GLContextDefaultResult::GLContextDefaultResult(bool static_result)
: GLContextResult(static_result){};
GLContextDefaultResult::~GLContextDefaultResult() = default;
GLContextSwitch::GLContextSwitch(std::unique_ptr<SwitchableGLContext> context)
: context_(std::move(context)) {
FML_CHECK(context_ != nullptr);
result_ = context_->SetCurrent();
};
GLContextSwitch::~GLContextSwitch() {
context_->RemoveCurrent();
};
} // namespace flutter