#include <texture.h>
Definition at line 70 of file texture.h.
◆ TextureRegistry()
flutter::TextureRegistry::TextureRegistry |
( |
| ) |
|
|
default |
◆ GetTexture()
std::shared_ptr< Texture > flutter::TextureRegistry::GetTexture |
( |
int64_t |
id | ) |
|
Definition at line 93 of file texture.cc.
93 {
94 auto it = mapping_.find(id);
95 return it != mapping_.end() ? it->second : nullptr;
96}
◆ OnGrContextCreated()
void flutter::TextureRegistry::OnGrContextCreated |
( |
| ) |
|
Definition at line 52 of file texture.cc.
52 {
53 for (auto& it : mapping_) {
54 it.second->OnGrContextCreated();
55 }
56
57
58
59 std::vector<InsertionOrderMap::value_type> ordered_images(
60 ordered_images_.begin(), ordered_images_.end());
61
62 for (const auto& [id, pair] : ordered_images) {
63 auto index_id = pair.first;
64 auto weak_image = pair.second;
65 if (
auto image = weak_image.lock()) {
66 image->OnGrContextCreated();
67 } else {
68 image_indices_.erase(index_id);
69 ordered_images_.erase(id);
70 }
71 }
72}
sk_sp< const SkImage > image
◆ OnGrContextDestroyed()
void flutter::TextureRegistry::OnGrContextDestroyed |
( |
| ) |
|
Definition at line 74 of file texture.cc.
74 {
75 for (auto& it : mapping_) {
76 it.second->OnGrContextDestroyed();
77 }
78
79 auto it = ordered_images_.begin();
80 while (it != ordered_images_.end()) {
81 auto index_id = it->second.first;
82 auto weak_image = it->second.second;
83 if (
auto image = weak_image.lock()) {
84 image->OnGrContextDestroyed();
85 it++;
86 } else {
87 image_indices_.erase(index_id);
88 it = ordered_images_.erase(it);
89 }
90 }
91}
◆ RegisterContextListener()
void flutter::TextureRegistry::RegisterContextListener |
( |
uintptr_t |
id, |
|
|
std::weak_ptr< ContextListener > |
image |
|
) |
| |
Definition at line 26 of file texture.cc.
28 {
29 size_t next_id = image_counter_++;
32 ordered_images_.erase(
result.first->second);
34 }
36}
static uint32_t next_id()
◆ RegisterTexture()
void flutter::TextureRegistry::RegisterTexture |
( |
const std::shared_ptr< Texture > & |
texture | ) |
|
◆ UnregisterContextListener()
void flutter::TextureRegistry::UnregisterContextListener |
( |
uintptr_t |
id | ) |
|
Definition at line 47 of file texture.cc.
47 {
48 ordered_images_.erase(image_indices_[id]);
49 image_indices_.erase(id);
50}
◆ UnregisterTexture()
void flutter::TextureRegistry::UnregisterTexture |
( |
int64_t |
id | ) |
|
Definition at line 38 of file texture.cc.
38 {
39 auto found = mapping_.find(id);
40 if (found == mapping_.end()) {
41 return;
42 }
43 found->second->OnTextureUnregistered();
44 mapping_.erase(found);
45}
The documentation for this class was generated from the following files: