Flutter Engine
 
Loading...
Searching...
No Matches
fl_pixel_buffer_texture_private.h File Reference

Go to the source code of this file.

Functions

G_BEGIN_DECLS gboolean fl_pixel_buffer_texture_populate (FlPixelBufferTexture *texture, uint32_t width, uint32_t height, FlutterOpenGLTexture *opengl_texture, GError **error)
 

Function Documentation

◆ fl_pixel_buffer_texture_populate()

G_BEGIN_DECLS gboolean fl_pixel_buffer_texture_populate ( FlPixelBufferTexture *  texture,
uint32_t  width,
uint32_t  height,
FlutterOpenGLTexture opengl_texture,
GError **  error 
)

fl_pixel_buffer_texture_populate: @texture: an #FlPixelBufferTexture. @width: width of the texture. @height: height of the texture. @opengl_texture: (out): return an FlutterOpenGLTexture. @error: (allow-none): #GError location to store the error occurring, or NULL to ignore.

Attempts to populate the specified @opengl_texture with texture details such as the name, width, height and the pixel format.

Returns: TRUE on success.

Definition at line 71 of file fl_pixel_buffer_texture.cc.

75 {
76 FlPixelBufferTexture* self = FL_PIXEL_BUFFER_TEXTURE(texture);
78 reinterpret_cast<FlPixelBufferTexturePrivate*>(
79 fl_pixel_buffer_texture_get_instance_private(self));
80
81 const uint8_t* buffer = nullptr;
82 if (!FL_PIXEL_BUFFER_TEXTURE_GET_CLASS(self)->copy_pixels(
83 self, &buffer, &width, &height, error)) {
84 return FALSE;
85 }
86
87 if (priv->texture_id == 0) {
88 glGenTextures(1, &priv->texture_id);
89 check_gl_error(__LINE__);
90 glBindTexture(GL_TEXTURE_2D, priv->texture_id);
91 check_gl_error(__LINE__);
92 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
93 check_gl_error(__LINE__);
94 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
95 check_gl_error(__LINE__);
96 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
97 check_gl_error(__LINE__);
98 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
99 check_gl_error(__LINE__);
100 } else {
101 glBindTexture(GL_TEXTURE_2D, priv->texture_id);
102 check_gl_error(__LINE__);
103 }
104 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA,
105 GL_UNSIGNED_BYTE, buffer);
106 check_gl_error(__LINE__);
107
108 opengl_texture->target = GL_TEXTURE_2D;
109 opengl_texture->name = priv->texture_id;
110 opengl_texture->format = GL_RGBA8;
111 opengl_texture->destruction_callback = nullptr;
112 opengl_texture->user_data = nullptr;
113 opengl_texture->width = width;
114 opengl_texture->height = height;
115
116 return TRUE;
117}
return TRUE
static void check_gl_error(int line)
FlPixelBufferTexturePrivate * priv
const uint8_t uint32_t uint32_t GError ** error
FlTexture * texture
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98
int32_t height
int32_t width
uint32_t name
The name of the texture.
Definition embedder.h:514
VoidCallback destruction_callback
Definition embedder.h:521
void * user_data
User data to be returned on the invocation of the destruction callback.
Definition embedder.h:518
size_t height
Height of the texture.
Definition embedder.h:529
uint32_t format
The texture format (example GL_RGBA8).
Definition embedder.h:516

References check_gl_error(), FlutterOpenGLTexture::destruction_callback, error, FlutterOpenGLTexture::format, height, FlutterOpenGLTexture::height, FlutterOpenGLTexture::name, priv, self, FlutterOpenGLTexture::target, texture, FlPixelBufferTexturePrivate::texture_id, TRUE, FlutterOpenGLTexture::user_data, width, and FlutterOpenGLTexture::width.

Referenced by fl_engine_gl_external_texture_frame_callback(), and TEST().