Flutter Engine
The Flutter Engine
Functions | Variables
fl_backing_store_provider.h File Reference
#include <gtk/gtk.h>
#include <cstdint>

Go to the source code of this file.

Functions

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (FlBackingStoreProvider, fl_backing_store_provider, FL, BACKING_STORE_PROVIDER, GObject) FlBackingStoreProvider *fl_backing_store_provider_new(int width
 
uint32_t fl_backing_store_provider_get_gl_framebuffer_id (FlBackingStoreProvider *provider)
 
uint32_t fl_backing_store_provider_get_gl_texture_id (FlBackingStoreProvider *provider)
 
uint32_t fl_backing_store_provider_get_gl_target (FlBackingStoreProvider *provider)
 
uint32_t fl_backing_store_provider_get_gl_format (FlBackingStoreProvider *provider)
 
GdkRectangle fl_backing_store_provider_get_geometry (FlBackingStoreProvider *provider)
 

Variables

G_BEGIN_DECLS int height
 

Function Documentation

◆ fl_backing_store_provider_get_geometry()

GdkRectangle fl_backing_store_provider_get_geometry ( FlBackingStoreProvider *  provider)

fl_backing_store_provider_get_geometry: @provider: an #FlBackingStoreProvider.

Gets geometry of framebuffer.

Returns: geometry of backing store.

Definition at line 105 of file fl_backing_store_provider.cc.

106 {
107 return self->geometry;
108}

◆ fl_backing_store_provider_get_gl_format()

uint32_t fl_backing_store_provider_get_gl_format ( FlBackingStoreProvider *  provider)

fl_backing_store_provider_get_gl_format: @provider: an #FlBackingStoreProvider.

Gets texture format (example GL_RGBA8).

Returns: texture format.

Definition at line 80 of file fl_backing_store_provider.cc.

80 {
81 // Flutter defines SK_R32_SHIFT=16, so SK_PMCOLOR_BYTE_ORDER should be BGRA.
82 // In Linux kN32_SkColorType is assumed to be kBGRA_8888_SkColorType.
83 // So we must choose a valid gl format to be compatible with surface format
84 // BGRA8.
85 // Following logic is copied from Skia GrGLCaps.cpp:
86 // https://github.com/google/skia/blob/4738ed711e03212aceec3cd502a4adb545f38e63/src/gpu/ganesh/gl/GrGLCaps.cpp#L1963-L2116
87
88 if (epoxy_is_desktop_gl()) {
89 // For OpenGL.
90 if (epoxy_gl_version() >= 12 || epoxy_has_gl_extension("GL_EXT_bgra")) {
91 return GL_RGBA8;
92 }
93 } else {
94 // For OpenGL ES.
95 if (epoxy_has_gl_extension("GL_EXT_texture_format_BGRA8888") ||
96 (epoxy_has_gl_extension("GL_APPLE_texture_format_BGRA8888") &&
97 epoxy_gl_version() >= 30)) {
98 return GL_BGRA8_EXT;
99 }
100 }
101 g_critical("Failed to determine valid GL format for Flutter rendering");
102 return GL_RGBA8;
103}
bool epoxy_has_gl_extension(const char *extension)
Definition: mock_epoxy.cc:403
bool epoxy_is_desktop_gl(void)
Definition: mock_epoxy.cc:407
int epoxy_gl_version(void)
Definition: mock_epoxy.cc:411

◆ fl_backing_store_provider_get_gl_framebuffer_id()

uint32_t fl_backing_store_provider_get_gl_framebuffer_id ( FlBackingStoreProvider *  provider)

fl_backing_store_provider_get_gl_framebuffer_id: @provider: an #FlBackingStoreProvider.

Gets created framebuffer id.

Returns: gl framebuffer id, 0 if creation failed.

Definition at line 66 of file fl_backing_store_provider.cc.

67 {
68 return self->framebuffer_id;
69}

◆ fl_backing_store_provider_get_gl_target()

uint32_t fl_backing_store_provider_get_gl_target ( FlBackingStoreProvider *  provider)

fl_backing_store_provider_get_gl_target: @provider: an #FlBackingStoreProvider.

Gets target texture (example GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE).

Returns: target texture.

Definition at line 76 of file fl_backing_store_provider.cc.

76 {
77 return GL_TEXTURE_2D;
78}

◆ fl_backing_store_provider_get_gl_texture_id()

uint32_t fl_backing_store_provider_get_gl_texture_id ( FlBackingStoreProvider *  provider)

fl_backing_store_provider_get_gl_texture_id: @provider: an #FlBackingStoreProvider.

Gets created texture id.

Returns: gl texture id, 0 if creation failed.

Definition at line 71 of file fl_backing_store_provider.cc.

72 {
73 return self->texture_id;
74}

◆ G_DECLARE_FINAL_TYPE()

G_BEGIN_DECLS G_DECLARE_FINAL_TYPE ( FlBackingStoreProvider  ,
fl_backing_store_provider  ,
FL  ,
BACKING_STORE_PROVIDER  ,
GObject   
)

FlBackingStoreProvider:

#FlBackingStoreProvider creates framebuffers and their backing textures for embedder compositor. fl_backing_store_provider_new: @width: width of texture. @height: height of texture.

Creates a new frame buffer. fl_renderer_make_current() must be called first.

Returns: a new #FlBackingStoreProvider.

Variable Documentation

◆ height

G_BEGIN_DECLS int height

Definition at line 37 of file fl_backing_store_provider.h.