Flutter Engine
The Flutter Engine
shell
platform
embedder
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
10
namespace
flutter
{
11
12
#ifdef SHELL_ENABLE_GL
13
EmbedderExternalTextureResolver::EmbedderExternalTextureResolver
(
14
EmbedderExternalTextureGL::ExternalTextureCallback
gl_callback)
15
: gl_callback_(
std
::move(gl_callback)) {}
16
#endif
17
18
#ifdef SHELL_ENABLE_METAL
19
EmbedderExternalTextureResolver::EmbedderExternalTextureResolver(
20
EmbedderExternalTextureMetal::ExternalTextureCallback metal_callback)
21
: metal_callback_(
std
::move(metal_callback)) {}
22
#endif
23
24
std::unique_ptr<Texture>
25
EmbedderExternalTextureResolver::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
43
bool
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
flutter::EmbedderExternalTextureGL::ExternalTextureCallback
std::function< std::unique_ptr< FlutterOpenGLTexture >(int64_t, size_t, size_t)> ExternalTextureCallback
Definition:
embedder_external_texture_gl.h:18
flutter::EmbedderExternalTextureResolver::EmbedderExternalTextureResolver
EmbedderExternalTextureResolver()=default
flutter
Definition:
asset_manager.cc:10
std
Definition:
ref_ptr.h:256
texture_id
int64_t texture_id
Definition:
texture_registrar_unittests.cc:24
Generated on Sun Jun 23 2024 21:55:14 for Flutter Engine by
1.9.4