Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
embedder_external_texture_resolver.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 "flutter/shell/platform/embedder/embedder_external_texture_resolver.h"
6
7#include <memory>
8#include <utility>
9
10namespace flutter {
11
12#ifdef SHELL_ENABLE_GL
15 : gl_callback_(std::move(gl_callback)) {}
16#endif
17
18#ifdef SHELL_ENABLE_METAL
19EmbedderExternalTextureResolver::EmbedderExternalTextureResolver(
20 EmbedderExternalTextureMetal::ExternalTextureCallback metal_callback)
21 : metal_callback_(std::move(metal_callback)) {}
22#endif
23
24std::unique_ptr<Texture>
25EmbedderExternalTextureResolver::ResolveExternalTexture(int64_t texture_id) {
26#ifdef SHELL_ENABLE_GL
27 if (gl_callback_) {
28 return std::make_unique<EmbedderExternalTextureGL>(texture_id,
29 gl_callback_);
30 }
31#endif
32
33#ifdef SHELL_ENABLE_METAL
34 if (metal_callback_) {
35 return std::make_unique<EmbedderExternalTextureMetal>(texture_id,
36 metal_callback_);
37 }
38#endif
39
40 return nullptr;
41}
42
43bool EmbedderExternalTextureResolver::SupportsExternalTextures() {
44#ifdef SHELL_ENABLE_GL
45 if (gl_callback_) {
46 return true;
47 }
48#endif
49
50#ifdef SHELL_ENABLE_METAL
51 if (metal_callback_) {
52 return true;
53 }
54#endif
55
56 return false;
57}
58
59} // namespace flutter
std::function< std::unique_ptr< FlutterOpenGLTexture >(int64_t, size_t, size_t)> ExternalTextureCallback
Definition ref_ptr.h:256
int64_t texture_id