Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
mock_texture_registrar.cc File Reference
#include "flutter/shell/platform/linux/testing/mock_texture_registrar.h"

Go to the source code of this file.

Classes

struct  _FlMockTextureRegistrar
 

Functions

static void fl_mock_texture_registrar_iface_init (FlTextureRegistrarInterface *iface)
 
 G_DEFINE_TYPE_WITH_CODE (FlMockTextureRegistrar, fl_mock_texture_registrar, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(fl_texture_registrar_get_type(), fl_mock_texture_registrar_iface_init)) static gboolean register_texture(FlTextureRegistrar *registrar
 
 if (self->texture !=nullptr)
 
static FlTexture * lookup_texture (FlTextureRegistrar *registrar, int64_t texture_id)
 
static gboolean mark_texture_frame_available (FlTextureRegistrar *registrar, FlTexture *texture)
 
static gboolean unregister_texture (FlTextureRegistrar *registrar, FlTexture *texture)
 
static void fl_mock_texture_registrar_dispose (GObject *object)
 
static void fl_mock_texture_registrar_class_init (FlMockTextureRegistrarClass *klass)
 
static void fl_mock_texture_registrar_init (FlMockTextureRegistrar *self)
 
FlMockTextureRegistrar * fl_mock_texture_registrar_new ()
 
FlTexture * fl_mock_texture_registrar_get_texture (FlMockTextureRegistrar *self)
 
gboolean fl_mock_texture_registrar_get_frame_available (FlMockTextureRegistrar *self)
 

Variables

FlTexture * texture
 
return TRUE
 

Function Documentation

◆ fl_mock_texture_registrar_class_init()

static void fl_mock_texture_registrar_class_init ( FlMockTextureRegistrarClass *  klass)
static

Definition at line 79 of file mock_texture_registrar.cc.

80 {
81 G_OBJECT_CLASS(klass)->dispose = fl_mock_texture_registrar_dispose;
82}
static void fl_mock_texture_registrar_dispose(GObject *object)

◆ fl_mock_texture_registrar_dispose()

static void fl_mock_texture_registrar_dispose ( GObject *  object)
static

Definition at line 73 of file mock_texture_registrar.cc.

73 {
74 FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(object);
75 g_clear_object(&self->texture);
76 G_OBJECT_CLASS(fl_mock_texture_registrar_parent_class)->dispose(object);
77}

◆ fl_mock_texture_registrar_get_frame_available()

gboolean fl_mock_texture_registrar_get_frame_available ( FlMockTextureRegistrar *  self)

Definition at line 95 of file mock_texture_registrar.cc.

96 {
97 return self->frame_available;
98}

◆ fl_mock_texture_registrar_get_texture()

FlTexture * fl_mock_texture_registrar_get_texture ( FlMockTextureRegistrar *  self)

Definition at line 91 of file mock_texture_registrar.cc.

91 {
92 return self->texture;
93}

◆ fl_mock_texture_registrar_iface_init()

static void fl_mock_texture_registrar_iface_init ( FlTextureRegistrarInterface *  iface)
static

Definition at line 65 of file mock_texture_registrar.cc.

66 {
67 iface->register_texture = register_texture;
68 iface->lookup_texture = lookup_texture;
69 iface->mark_texture_frame_available = mark_texture_frame_available;
70 iface->unregister_texture = unregister_texture;
71}
static gboolean register_texture(FlTextureRegistrar *registrar, FlTexture *texture)
static gboolean mark_texture_frame_available(FlTextureRegistrar *registrar, FlTexture *texture)
static FlTexture * lookup_texture(FlTextureRegistrar *registrar, int64_t texture_id)
static gboolean unregister_texture(FlTextureRegistrar *registrar, FlTexture *texture)

◆ fl_mock_texture_registrar_init()

static void fl_mock_texture_registrar_init ( FlMockTextureRegistrar *  self)
static

Definition at line 84 of file mock_texture_registrar.cc.

84{}

◆ fl_mock_texture_registrar_new()

FlMockTextureRegistrar * fl_mock_texture_registrar_new ( )

Definition at line 86 of file mock_texture_registrar.cc.

86 {
87 return FL_MOCK_TEXTURE_REGISTRAR(
88 g_object_new(fl_mock_texture_registrar_get_type(), nullptr));
89}

◆ G_DEFINE_TYPE_WITH_CODE()

G_DEFINE_TYPE_WITH_CODE ( FlMockTextureRegistrar  ,
fl_mock_texture_registrar  ,
G_TYPE_OBJECT  ,
G_IMPLEMENT_INTERFACE(fl_texture_registrar_get_type(), fl_mock_texture_registrar_iface_init  
)

◆ if()

if ( self->texture = nullptr)

Definition at line 26 of file mock_texture_registrar.cc.

26 {
27 return FALSE;
28 }
return FALSE

◆ lookup_texture()

static FlTexture * lookup_texture ( FlTextureRegistrar *  registrar,
int64_t  texture_id 
)
static

Definition at line 33 of file mock_texture_registrar.cc.

34 {
35 FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
36 if (self->texture != nullptr &&
37 fl_texture_get_id(self->texture) == texture_id) {
38 return self->texture;
39 }
40 return nullptr;
41}
G_MODULE_EXPORT int64_t fl_texture_get_id(FlTexture *self)
Definition fl_texture.cc:20
int64_t texture_id

◆ mark_texture_frame_available()

static gboolean mark_texture_frame_available ( FlTextureRegistrar *  registrar,
FlTexture *  texture 
)
static

Definition at line 43 of file mock_texture_registrar.cc.

44 {
45 FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
46 if (lookup_texture(registrar, fl_texture_get_id(texture)) == nullptr) {
47 return FALSE;
48 }
49 self->frame_available = TRUE;
50 return TRUE;
51}
FlTexture * texture
return TRUE

◆ unregister_texture()

static gboolean unregister_texture ( FlTextureRegistrar *  registrar,
FlTexture *  texture 
)
static

Definition at line 53 of file mock_texture_registrar.cc.

54 {
55 FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar);
56 if (self->texture != texture) {
57 return FALSE;
58 }
59
60 g_clear_object(&self->texture);
61
62 return TRUE;
63}

Variable Documentation

◆ texture

self texture
Initial value:
{
FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar)

Definition at line 24 of file mock_texture_registrar.cc.

◆ TRUE

return TRUE

Definition at line 30 of file mock_texture_registrar.cc.