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