| Flutter Impeller |

context.cc
Go to the documentation of this file.
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 "impeller/toolkit/interop/context.h"
6
7 #include "impeller/typographer/backends/skia/typographer_context_skia.h"
8
9 namespace impeller::interop {
10
11 Context::Context(std::shared_ptr<impeller::Context> context)
12 : context_(std::move(context), TypographerContextSkia::Make()) {}
13
14 Context::~Context() = default;
15
16 bool Context::IsValid() const {
17 return context_.IsValid();
18 }
19
20 std::shared_ptr<impeller::Context> Context::GetContext() const {
21 return context_.GetContext();
22 }
23
24 AiksContext& Context::GetAiksContext() {
25 return context_;
26 }
27
28 bool Context::IsBackend(impeller::Context::BackendType type) const {
29 if (!IsValid()) {
30 return false;
31 }
32 return GetContext()->GetBackendType() == type;
33 }
34
35 bool Context::IsGL() const {
36 return IsBackend(impeller::Context::BackendType::kOpenGLES);
37 }
38
39 bool Context::IsMetal() const {
40 return IsBackend(impeller::Context::BackendType::kMetal);
41 }
42
43 bool Context::IsVulkan() const {
44 return IsBackend(impeller::Context::BackendType::kVulkan);
45 }
46
47 } // namespace impeller::interop
type
GLenum type
Definition: blit_command_gles.cc:153
impeller::AiksContext
Definition: aiks_context.h:20
impeller::AiksContext::IsValid
bool IsValid() const
Definition: aiks_context.cc:34
impeller::AiksContext::GetContext
std::shared_ptr< Context > GetContext() const
Definition: aiks_context.cc:38
impeller::Context::BackendType
BackendType
Definition: context.h:67
impeller::Context::BackendType::kOpenGLES
@ kOpenGLES
impeller::Context::BackendType::kMetal
@ kMetal
impeller::Context::BackendType::kVulkan
@ kVulkan
impeller::TypographerContextSkia
Definition: typographer_context_skia.h:12
impeller::interop::Context::IsMetal
bool IsMetal() const
Definition: context.cc:39
impeller::interop::Context::GetContext
std::shared_ptr< impeller::Context > GetContext() const
Definition: context.cc:20
impeller::interop::Context::IsBackend
bool IsBackend(impeller::Context::BackendType type) const
Definition: context.cc:28
impeller::interop::Context::IsVulkan
bool IsVulkan() const
Definition: context.cc:43
impeller::interop::Context::IsValid
bool IsValid() const
Definition: context.cc:16
impeller::interop::Context::IsGL
bool IsGL() const
Definition: context.cc:35
impeller::interop::Context::Context
Context(const Context &)=delete
impeller::interop::Context::~Context
~Context() override
impeller::interop::Context::GetAiksContext
AiksContext & GetAiksContext()
Definition: context.cc:24
impeller::interop
Definition: context_gles.cc:12
std
Definition: comparable.h:95
context.h
typographer_context_skia.h