| Flutter Linux 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 211 of file core_implementations.cc.

213 : texture_registrar_ref_(texture_registrar_ref) {}

## ◆ ~TextureRegistrarImpl()

flutter::TextureRegistrarImpl::~TextureRegistrarImpl | ( |  | ) |
| virtualdefault

## ◆ TextureRegistrarImpl() [2/2]

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

## Member Function Documentation

## ◆ MarkTextureFrameAvailable()

bool flutter::TextureRegistrarImpl::MarkTextureFrameAvailable | ( | int64_t | texture_id | ) |
| overridevirtual

Implements flutter::TextureRegistrar.

Definition at line 251 of file core_implementations.cc.

251 {
252 return FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(
253 texture_registrar_ref_, texture_id);
254 }
FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable
FLUTTER_EXPORT bool FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id)
texture_id
int64_t texture_id
Definition: texture_registrar_unittests.cc:24

References FlutterDesktopTextureRegistrarMarkExternalTextureFrameAvailable(), and texture_id.

## ◆ operator=()

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

## ◆ RegisterTexture()

int64_t flutter::TextureRegistrarImpl::RegisterTexture | ( | TextureVariant * | texture | ) |
| overridevirtual

Implements flutter::TextureRegistrar.

Definition at line 217 of file core_implementations.cc.

217 {
218 FlutterDesktopTextureInfo info = {};
219 if (auto pixel_buffer_texture = std::get_if<PixelBufferTexture>(texture)) {
220 info.type = kFlutterDesktopPixelBufferTexture;
221 info.pixel_buffer_config.user_data = pixel_buffer_texture;
222 info.pixel_buffer_config.callback =
223 [](size_t width, size_t height,
224 void* user_data) -> const FlutterDesktopPixelBuffer* {
225 auto texture = static_cast<PixelBufferTexture*>(user_data);
226 return texture->CopyPixelBuffer(width, height);
227 };
228 } else if (auto gpu_surface_texture =
229 std::get_if<GpuSurfaceTexture>(texture)) {
230 info.type = kFlutterDesktopGpuSurfaceTexture;
231 info.gpu_surface_config.struct_size =
232 sizeof(FlutterDesktopGpuSurfaceTextureConfig);
233 info.gpu_surface_config.type = gpu_surface_texture->surface_type();
234 info.gpu_surface_config.user_data = gpu_surface_texture;
235 info.gpu_surface_config.callback =
236 [](size_t width, size_t height,
237 void* user_data) -> const FlutterDesktopGpuSurfaceDescriptor* {
238 auto texture = static_cast<GpuSurfaceTexture*>(user_data);
239 return texture->ObtainDescriptor(width, height);
240 };
241 } else {
242 std::cerr << "Attempting to register unknown texture variant." << std::endl;
243 return -1;
244 }
245
246 int64_t texture_id = FlutterDesktopTextureRegistrarRegisterExternalTexture(
247 texture_registrar_ref_, &info);
248 return texture_id;
249 } // namespace flutter
height
self height
Definition: fl_compositor_software.cc:43
width
self width
Definition: fl_compositor_software.cc:42
user_data
G_BEGIN_DECLS G_MODULE_EXPORT FlValue gpointer user_data
Definition: fl_event_channel.h:90
FlutterDesktopTextureRegistrarRegisterExternalTexture
FLUTTER_EXPORT int64_t FlutterDesktopTextureRegistrarRegisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, const FlutterDesktopTextureInfo *info)
kFlutterDesktopGpuSurfaceTexture
@ kFlutterDesktopGpuSurfaceTexture
Definition: flutter_texture_registrar.h:28
kFlutterDesktopPixelBufferTexture
@ kFlutterDesktopPixelBufferTexture
Definition: flutter_texture_registrar.h:26
FlutterDesktopGpuSurfaceDescriptor
Definition: flutter_texture_registrar.h:70
FlutterDesktopGpuSurfaceTextureConfig
Definition: flutter_texture_registrar.h:138
FlutterDesktopGpuSurfaceTextureConfig::callback
FlutterDesktopGpuSurfaceTextureCallback callback
Definition: flutter_texture_registrar.h:146
FlutterDesktopGpuSurfaceTextureConfig::type
FlutterDesktopGpuSurfaceType type
Definition: flutter_texture_registrar.h:144
FlutterDesktopGpuSurfaceTextureConfig::user_data
void * user_data
Definition: flutter_texture_registrar.h:148
FlutterDesktopGpuSurfaceTextureConfig::struct_size
size_t struct_size
Definition: flutter_texture_registrar.h:141
FlutterDesktopPixelBuffer
Definition: flutter_texture_registrar.h:56
FlutterDesktopPixelBufferTextureConfig::user_data
void * user_data
Definition: flutter_texture_registrar.h:134
FlutterDesktopPixelBufferTextureConfig::callback
FlutterDesktopPixelBufferTextureCallback callback
Definition: flutter_texture_registrar.h:132
FlutterDesktopTextureInfo
Definition: flutter_texture_registrar.h:151
FlutterDesktopTextureInfo::gpu_surface_config
FlutterDesktopGpuSurfaceTextureConfig gpu_surface_config
Definition: flutter_texture_registrar.h:155
FlutterDesktopTextureInfo::type
FlutterDesktopTextureType type
Definition: flutter_texture_registrar.h:152
FlutterDesktopTextureInfo::pixel_buffer_config
FlutterDesktopPixelBufferTextureConfig pixel_buffer_config
Definition: flutter_texture_registrar.h:154

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

## ◆ UnregisterTexture() [1/2]

bool flutter::TextureRegistrarImpl::UnregisterTexture | ( | int64_t | texture_id | ) |
| overridevirtual

Implements flutter::TextureRegistrar.

Definition at line 279 of file core_implementations.cc.

279 {
280 UnregisterTexture(texture_id, nullptr);
281 return true;
282 }
flutter::TextureRegistrarImpl::UnregisterTexture
void UnregisterTexture(int64_t texture_id, std::function< void()> callback) override
Definition: core_implementations.cc:256

References texture_id, and UnregisterTexture().

## ◆ UnregisterTexture() [2/2]

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

Implements flutter::TextureRegistrar.

Definition at line 256 of file core_implementations.cc.

257 {
258 if (callback == nullptr) {
259 FlutterDesktopTextureRegistrarUnregisterExternalTexture(
260 texture_registrar_ref_, texture_id, nullptr, nullptr);
261 return;
262 }
263
264 struct Captures {
265 std::function<void()> callback;
266 };
267 auto captures = new Captures();
268 captures->callback = std::move(callback);
269 FlutterDesktopTextureRegistrarUnregisterExternalTexture(
270 texture_registrar_ref_, texture_id,
271 [](void* opaque) {
272 auto captures = reinterpret_cast<Captures*>(opaque);
273 captures->callback();
274 delete captures;
275 },
276 captures);
277 }
FlutterDesktopTextureRegistrarUnregisterExternalTexture
FLUTTER_EXPORT void FlutterDesktopTextureRegistrarUnregisterExternalTexture(FlutterDesktopTextureRegistrarRef texture_registrar, int64_t texture_id, void(*callback)(void *user_data), void *user_data)

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