| 62 | } |
| 63 | |
| 64 | void GDREGuiIcons::init() { |
| 65 | MutexLock lock(init_lock); |
| 66 | if (initialized) { |
| 67 | return; |
| 68 | } |
| 69 | // We have to initialize the svg renderer first because the `svg` module is initialized after the `gdsdecomp` module (alphabetical order). |
| 70 | Vector<float> scales = { 1.0 }; |
| 71 | auto fallback_scale = ThemeDB::get_singleton()->get_fallback_base_scale(); |
| 72 | if (!scales.has(fallback_scale)) { |
| 73 | scales.push_back(fallback_scale); |
| 74 | } |
| 75 | for (float scale : scales) { |
| 76 | // Initialize all icons for this scale (lock already held) |
| 77 | if (!icons.has(scale)) { |
| 78 | for (int i = 0; i < gdre_icons_count; i++) { |
| 79 | icons[scale][gdre_icons_names[i]] = generate_icon(i, scale); |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | initialized = true; |
| 85 | } |
| 86 | |
| 87 | void GDREGuiIcons::init_for_scale(float scale) { |
| 88 | MutexLock lock(init_lock); |