| Flutter iOS Embedder |

Public Member Functions | List of all members
flutter::TextureRegistrarImpl Class Reference

`#include <texture_registrar_impl.h>`

Inheritance diagram for flutter::TextureRegistrarImpl:

## Public Member Functions
| TextureRegistrarImpl (FlutterDesktopTextureRegistrarRef texture_registrar_ref)
virtual | ~TextureRegistrarImpl ()
| TextureRegistrarImpl (TextureRegistrarImpl const &)=delete
TextureRegistrarImpl & | operator= (TextureRegistrarImpl const &)=delete
int64_t | RegisterTexture (TextureVariant *texture) override
bool | MarkTextureFrameAvailable (int64_t texture_id) override
void | UnregisterTexture (int64_t texture_id, std::function< void()> callback) override
bool | UnregisterTexture (int64_t texture_id) override
Public Member Functions inherited from flutter::TextureRegistrar
virtual | ~TextureRegistrar ()=default

## Detailed Description

Definition at line 14 of file texture_registrar_impl.h.

## Constructor & Destructor Documentation

## ◆ TextureRegistrarImpl() [1/2]

flutter::TextureRegistrarImpl::TextureRegistrarImpl | ( | FlutterDesktopTextureRegistrarRef | texture_registrar_ref | ) |
| explicit

Definition at line 169 of file core_implementations.cc.

171 : texture_registrar_ref_(texture_registrar_ref) {}

## ◆ ~TextureRegistrarImpl()

flutter::TextureRegistrarImpl::~TextureRegistrarImpl | ( |  | ) |
| virtual default

## ◆ TextureRegistrarImpl() [2/2]

flutter::TextureRegistrarImpl::TextureRegistrarImpl | ( | TextureRegistrarImpl const & |  | ) |
| delete

## Member Function Documentation

## ◆ MarkTextureFrameAvailable()

bool flutter::TextureRegistrarImpl::MarkTextureFrameAvailable | ( | int64_t | texture_id | ) |
| override virtual

Implements flutter::TextureRegistrar.

Definition at line 209 of file core_implementations.cc.

209 {
210 return FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(
211 texture_registrar_ref_, texture_id);
212 }

References FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(), and texture_id.

## ◆ operator=()

TextureRegistrarImpl& flutter::TextureRegistrarImpl::operator= | ( | TextureRegistrarImpl const & |  | ) |
| delete

## ◆ RegisterTexture()

int64_t flutter::TextureRegistrarImpl::RegisterTexture | ( | TextureVariant * | texture | ) |
| override virtual

Implements flutter::TextureRegistrar.

Definition at line 175 of file core_implementations.cc.

175 {
176 FlutterDesktopTextureInfo info = {};
177 if (auto pixel_buffer_texture = std::get_if<PixelBufferTexture>(texture)) {
178 info.type = kFlutterDesktopPixelBufferTexture;
179 info.pixel_buffer_config.user_data = pixel_buffer_texture;
180 info.pixel_buffer_config.callback =
181 [](size_t width, size_t height,
182 void* user_data) -> const FlutterDesktopPixelBuffer* {
183 auto texture = static_cast<PixelBufferTexture*>(user_data);
184 return texture->CopyPixelBuffer(width, height);
185 };
186 } else if (auto gpu_surface_texture =
187 std::get_if<GpuSurfaceTexture>(texture)) {
188 info.type = kFlutterDesktopGpuSurfaceTexture;
189 info.gpu_surface_config.struct_size =
190 sizeof(FlutterDesktopGpuSurfaceTextureConfig);
191 info.gpu_surface_config.type = gpu_surface_texture->surface_type();
192 info.gpu_surface_config.user_data = gpu_surface_texture;
193 info.gpu_surface_config.callback =
194 [](size_t width, size_t height,
195 void* user_data) -> const FlutterDesktopGpuSurfaceDescriptor* {
196 auto texture = static_cast<GpuSurfaceTexture*>(user_data);
197 return texture->ObtainDescriptor(width, height);
198 };
199 } else {
200 std::cerr << "Attempting to register unknown texture variant." << std::endl;
201 return -1;
202 }
203
204 int64_t texture_id = FlutterDesktopTextureRegistrarRegisterExternalTexture(
205 texture_registrar_ref_, &info);
206 return texture_id;
207 } // namespace flutter

References FlutterDesktopPixelBufferTextureConfig::callback, FlutterDesktopGpuSurfaceTextureConfig::callback, flutter::PixelBufferTexture::CopyPixelBuffer(), FlutterDesktopTextureRegistrarRegisterExternalTexture(), FlutterDesktopTextureInfo::gpu_surface_config, kFlutterDesktopGpuSurfaceTexture, kFlutterDesktopPixelBufferTexture, flutter::GpuSurfaceTexture::ObtainDescriptor(), FlutterDesktopTextureInfo::pixel_buffer_config, FlutterDesktopGpuSurfaceTextureConfig::struct_size, texture_id, FlutterDesktopGpuSurfaceTextureConfig::type, FlutterDesktopTextureInfo::type, user_data, FlutterDesktopPixelBufferTextureConfig::user_data, and FlutterDesktopGpuSurfaceTextureConfig::user_data.

## ◆ UnregisterTexture() [1/2]

bool flutter::TextureRegistrarImpl::UnregisterTexture | ( | int64_t | texture_id | ) |
| override virtual

Implements flutter::TextureRegistrar.

Definition at line 237 of file core_implementations.cc.

237 {
238 UnregisterTexture(texture_id, nullptr);
239 return true;
240 }

References texture_id, and UnregisterTexture().

## ◆ UnregisterTexture() [2/2]

void flutter::TextureRegistrarImpl::UnregisterTexture | ( | int64_t | texture_id,
|  | std::function< void()> | callback
| ) |  |
| override virtual

Implements flutter::TextureRegistrar.

Definition at line 214 of file core_implementations.cc.

215 {
216 if (callback == nullptr) {
217 FlutterDesktopTextureRegistrarUnregisterExternalTexture(
218 texture_registrar_ref_, texture_id, nullptr, nullptr);
219 return;
220 }
221
222 struct Captures {
223 std::function<void()> callback;
224 };
225 auto captures = new Captures();
226 captures->callback = std::move(callback);
227 FlutterDesktopTextureRegistrarUnregisterExternalTexture(
228 texture_registrar_ref_, texture_id,
229 [](void* opaque) {
230 auto captures = reinterpret_cast<Captures*>(opaque);
231 captures->callback();
232 delete captures;
233 },
234 captures);
235 }

References FlutterDesktopTextureRegistrarUnregisterExternalTexture(), and texture_id.

Referenced by UnregisterTexture().

The documentation for this class was generated from the following files:

- shell/platform/common/client_wrapper/texture_registrar_impl.h
- shell/platform/common/client_wrapper/core_implementations.cc

kFlutterDesktopGpuSurfaceTexture
@ kFlutterDesktopGpuSurfaceTexture
Definition: flutter_texture_registrar.h:28
FlutterDesktopTextureRegistrarRegisterExternalTexture
FLUTTER_EXPORT int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, const FlutterDesktopTextureInfo *info)
FlutterDesktopPixelBuffer
Definition: flutter_texture_registrar.h:56
user_data
void * user_data
Definition: texture_registrar_unittests.cc:27
FlutterDesktopPixelBufferTextureConfig::user_data
void * user_data
Definition: flutter_texture_registrar.h:134
FlutterDesktopGpuSurfaceTextureConfig::user_data
void * user_data
Definition: flutter_texture_registrar.h:148
FlutterDesktopPixelBufferTextureConfig::callback
FlutterDesktopPixelBufferTextureCallback callback
Definition: flutter_texture_registrar.h:132
FlutterDesktopTextureInfo::type
FlutterDesktopTextureType type
Definition: flutter_texture_registrar.h:152
FlutterDesktopGpuSurfaceTextureConfig::struct_size
size_t struct_size
Definition: flutter_texture_registrar.h:141
FlutterDesktopTextureInfo::pixel_buffer_config
FlutterDesktopPixelBufferTextureConfig pixel_buffer_config
Definition: flutter_texture_registrar.h:154
FlutterDesktopGpuSurfaceTextureConfig::type
FlutterDesktopGpuSurfaceType type
Definition: flutter_texture_registrar.h:144
FlutterDesktopTextureInfo
Definition: flutter_texture_registrar.h:151
FlutterDesktopGpuSurfaceTextureConfig::callback
FlutterDesktopGpuSurfaceTextureCallback callback
Definition: flutter_texture_registrar.h:146
FlutterDesktopGpuSurfaceDescriptor
Definition: flutter_texture_registrar.h:70
flutter::TextureRegistrarImpl::UnregisterTexture
void UnregisterTexture(int64_t texture_id, std::function< void()> callback) override
Definition: core_implementations.cc:214
FlutterDesktopTextureInfo::gpu_surface_config
FlutterDesktopGpuSurfaceTextureConfig gpu_surface_config
Definition: flutter_texture_registrar.h:155
FlutterDesktopTextureRegistrarUnregisterExternalTexture
FLUTTER_EXPORT void FlutterDesktopTextureRegistrarUnregisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id, void(*callback)(void *user_data), void *user_data)
FlutterDesktopGpuSurfaceTextureConfig
Definition: flutter_texture_registrar.h:138
FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable
FLUTTER_EXPORT bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id)
texture_id
int64_t texture_id
Definition: texture_registrar_unittests.cc:24
kFlutterDesktopPixelBufferTexture
@ kFlutterDesktopPixelBufferTexture
Definition: flutter_texture_registrar.h:26