diff --git a/release/datafiles/icons_svg/blender_logo_large.svg b/release/datafiles/icons_svg/blender_logo_large.svg
index b4034647c9e..28cbbd4fc8b 100644
--- a/release/datafiles/icons_svg/blender_logo_large.svg
+++ b/release/datafiles/icons_svg/blender_logo_large.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/release/datafiles/icons_svg/cancel_large.svg b/release/datafiles/icons_svg/cancel_large.svg
index 85467ff3ef8..f6114491bc4 100644
--- a/release/datafiles/icons_svg/cancel_large.svg
+++ b/release/datafiles/icons_svg/cancel_large.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/release/datafiles/icons_svg/info_large.svg b/release/datafiles/icons_svg/info_large.svg
index 8dd2858f563..117992bc11f 100644
--- a/release/datafiles/icons_svg/info_large.svg
+++ b/release/datafiles/icons_svg/info_large.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/release/datafiles/icons_svg/question_large.svg b/release/datafiles/icons_svg/question_large.svg
index 9f57bff48d9..51bfca7587b 100644
--- a/release/datafiles/icons_svg/question_large.svg
+++ b/release/datafiles/icons_svg/question_large.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/release/datafiles/icons_svg/warning_large.svg b/release/datafiles/icons_svg/warning_large.svg
index 27a9eee8be1..95f6250817c 100644
--- a/release/datafiles/icons_svg/warning_large.svg
+++ b/release/datafiles/icons_svg/warning_large.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/source/blender/blenfont/BLF_api.hh b/source/blender/blenfont/BLF_api.hh
index 95538a7e2c5..f7c14cd026e 100644
--- a/source/blender/blenfont/BLF_api.hh
+++ b/source/blender/blenfont/BLF_api.hh
@@ -157,7 +157,12 @@ void BLF_draw_svg_icon(uint icon_id,
blender::FunctionRef edit_source_cb = nullptr);
blender::Array BLF_svg_icon_bitmap(
- uint icon_id, float size, int *r_width, int *r_height, bool multicolor = false);
+ uint icon_id,
+ float size,
+ int *r_width,
+ int *r_height,
+ bool multicolor = false,
+ blender::FunctionRef edit_source_cb = nullptr);
typedef bool (*BLF_GlyphBoundsFn)(const char *str,
size_t str_step_ofs,
diff --git a/source/blender/blenfont/intern/blf.cc b/source/blender/blenfont/intern/blf.cc
index 4f2cc1a1ae8..4a50edc2d51 100644
--- a/source/blender/blenfont/intern/blf.cc
+++ b/source/blender/blenfont/intern/blf.cc
@@ -632,13 +632,17 @@ void BLF_draw_svg_icon(uint icon_id,
#endif /* WITH_HEADLESS */
}
-blender::Array BLF_svg_icon_bitmap(
- uint icon_id, float size, int *r_width, int *r_height, bool multicolor)
+blender::Array BLF_svg_icon_bitmap(uint icon_id,
+ float size,
+ int *r_width,
+ int *r_height,
+ bool multicolor,
+ blender::FunctionRef edit_source_cb)
{
#ifndef WITH_HEADLESS
FontBLF *font = global_font[0];
if (font) {
- return blf_svg_icon_bitmap(font, icon_id, size, r_width, r_height, multicolor);
+ return blf_svg_icon_bitmap(font, icon_id, size, r_width, r_height, multicolor, edit_source_cb);
}
#else
UNUSED_VARS(icon_id, size, r_width, r_height, multicolor);
diff --git a/source/blender/blenfont/intern/blf_font.cc b/source/blender/blenfont/intern/blf_font.cc
index 8a4592bdefc..03c03604672 100644
--- a/source/blender/blenfont/intern/blf_font.cc
+++ b/source/blender/blenfont/intern/blf_font.cc
@@ -571,12 +571,17 @@ void blf_draw_svg_icon(FontBLF *font,
blf_glyph_cache_release(font);
}
-blender::Array blf_svg_icon_bitmap(
- FontBLF *font, uint icon_id, float size, int *r_width, int *r_height, bool multicolor)
+blender::Array blf_svg_icon_bitmap(FontBLF *font,
+ uint icon_id,
+ float size,
+ int *r_width,
+ int *r_height,
+ bool multicolor,
+ blender::FunctionRef edit_source_cb)
{
blf_font_size(font, size);
GlyphCacheBLF *gc = blf_glyph_cache_acquire(font);
- GlyphBLF *g = blf_glyph_ensure_icon(gc, icon_id, multicolor);
+ GlyphBLF *g = blf_glyph_ensure_icon(gc, icon_id, multicolor, edit_source_cb);
if (!g) {
blf_glyph_cache_release(font);
diff --git a/source/blender/blenfont/intern/blf_internal.hh b/source/blender/blenfont/intern/blf_internal.hh
index 95e5b8b8f71..b75d337b4d3 100644
--- a/source/blender/blenfont/intern/blf_internal.hh
+++ b/source/blender/blenfont/intern/blf_internal.hh
@@ -112,7 +112,13 @@ void blf_draw_svg_icon(FontBLF *font,
blender::FunctionRef edit_source_cb = nullptr);
blender::Array blf_svg_icon_bitmap(
- FontBLF *font, uint icon_id, float size, int *r_width, int *r_height, bool multicolor = false);
+ FontBLF *font,
+ uint icon_id,
+ float size,
+ int *r_width,
+ int *r_height,
+ bool multicolor = false,
+ blender::FunctionRef edit_source_cb = nullptr);
blender::Vector blf_font_string_wrap(FontBLF *font,
blender::StringRef str,
diff --git a/source/blender/editors/include/UI_interface_icons.hh b/source/blender/editors/include/UI_interface_icons.hh
index 16f0b86994d..fffadc95cb1 100644
--- a/source/blender/editors/include/UI_interface_icons.hh
+++ b/source/blender/editors/include/UI_interface_icons.hh
@@ -98,6 +98,8 @@ void UI_icon_draw_ex(float x,
const IconTextOverlay *text_overlay,
const bool inverted = false);
+ImBuf *UI_svg_icon_bitmap(uint icon_id, float size, bool multicolor = false);
+
void UI_icons_free();
void UI_icons_free_drawinfo(void *drawinfo);
diff --git a/source/blender/editors/interface/interface_icons.cc b/source/blender/editors/interface/interface_icons.cc
index 03ec4709f4c..349b99b320a 100644
--- a/source/blender/editors/interface/interface_icons.cc
+++ b/source/blender/editors/interface/interface_icons.cc
@@ -2005,6 +2005,38 @@ void UI_icon_draw_ex(float x,
inverted);
}
+ImBuf *UI_svg_icon_bitmap(uint icon_id, float size, bool multicolor)
+{
+ if (icon_id >= ICON_BLANK_LAST_SVG_ITEM) {
+ return nullptr;
+ }
+
+ ImBuf *ibuf = nullptr;
+ int width;
+ int height;
+ blender::Array bitmap;
+
+ if (multicolor) {
+ bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, true, icon_source_edit_cb);
+ }
+ else {
+ bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, false, nullptr);
+ }
+
+ if (!bitmap.is_empty()) {
+ ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
+ }
+
+ if (ibuf) {
+ IMB_flipy(ibuf);
+ if (multicolor) {
+ IMB_premultiply_alpha(ibuf);
+ }
+ }
+
+ return ibuf;
+}
+
void UI_icon_text_overlay_init_from_count(IconTextOverlay *text_overlay,
const int icon_indicator_number)
{
@@ -2025,8 +2057,6 @@ ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon, float size)
return nullptr;
#else
- constexpr bool show_color = false;
-
int icon_id = ICON_NONE;
switch (icon) {
case ALERT_ICON_WARNING:
@@ -2049,17 +2079,6 @@ ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon, float size)
return nullptr;
}
- int width;
- int height;
- blender::Array bitmap = BLF_svg_icon_bitmap(icon_id, size, &width, &height, show_color);
- if (bitmap.is_empty()) {
- return nullptr;
- }
- ImBuf *ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
- IMB_flipy(ibuf);
- if (show_color) {
- IMB_premultiply_alpha(ibuf);
- }
- return ibuf;
+ return UI_svg_icon_bitmap(icon_id, size, false);
#endif
}
diff --git a/source/blender/editors/space_file/filelist.cc b/source/blender/editors/space_file/filelist.cc
index 87535f10c65..2d830845006 100644
--- a/source/blender/editors/space_file/filelist.cc
+++ b/source/blender/editors/space_file/filelist.cc
@@ -1134,15 +1134,7 @@ void filelist_setlibrary(FileList *filelist, const AssetLibraryReference *asset_
static ImBuf *fileimage_from_icon(int icon_id)
{
- int width;
- int height;
- blender::Array bitmap = BLF_svg_icon_bitmap(icon_id, 256.0f, &width, &height);
- if (bitmap.is_empty()) {
- return nullptr;
- }
- ImBuf *ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
- IMB_flipy(ibuf);
- return ibuf;
+ return UI_svg_icon_bitmap(icon_id, 256.0f, false);
}
void filelist_init_icons()
diff --git a/source/blender/windowmanager/intern/wm_splash_screen.cc b/source/blender/windowmanager/intern/wm_splash_screen.cc
index 0950e0af76a..8ef59e5dc63 100644
--- a/source/blender/windowmanager/intern/wm_splash_screen.cc
+++ b/source/blender/windowmanager/intern/wm_splash_screen.cc
@@ -314,21 +314,10 @@ static uiBlock *wm_block_about_create(bContext *C, ARegion *region, void * /*arg
#ifndef WITH_HEADLESS
float size = 0.2f * dialog_width;
- ImBuf *ibuf = nullptr;
- int width;
- int height;
- blender::Array bitmap = BLF_svg_icon_bitmap(
- ICON_BLENDER_LOGO_LARGE, size, &width, &height, show_color);
- if (!bitmap.is_empty()) {
- ibuf = IMB_allocFromBuffer(bitmap.data(), nullptr, width, height, 4);
- }
+
+ ImBuf *ibuf = UI_svg_icon_bitmap(ICON_BLENDER_LOGO_LARGE, size, show_color);
if (ibuf) {
- IMB_flipy(ibuf);
- if (show_color) {
- IMB_premultiply_alpha(ibuf);
- }
-
bTheme *btheme = UI_GetTheme();
const uchar *color = btheme->tui.wcol_menu_back.text_sel;