MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / generate_icon

Function generate_icon

gui/gui_icons.cpp:17–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15GDREGuiIcons *GDREGuiIcons::singleton = nullptr;
16namespace {
17static inline Ref<ImageTexture> generate_icon(int p_index, float scale) {
18 ERR_FAIL_INDEX_V(p_index, gdre_icons_count, nullptr);
19 Ref<Image> img = memnew(Image);
20
21#ifdef MODULE_SVG_ENABLED
22 // Upsample icon generation only if the scale isn't an integer multiplier.
23 // Generating upsampled icons is slower, and the benefit is hardly visible
24 // with integer scales.
25 ImageLoaderSVG img_loader;
26 img_loader.create_image_from_string(img, gdre_icons_sources[p_index], scale, false, false);
27#endif
28
29 return ImageTexture::create_from_image(img);
30}
31} //namespace
32
33int get_icon_index(const StringName &p_name) {

Callers 2

initMethod · 0.85
init_for_scaleMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected