Follow-up of 81cebe5be3
- Fixed crash at startup when any of the svg files used as icon into imgui dialog (and/or splash screen icon) is renamed/removed.
This commit is contained in:
parent
102d3e0d2c
commit
745a454081
@ -216,7 +216,11 @@ public:
|
|||||||
// load bitmap for logo
|
// load bitmap for logo
|
||||||
BitmapCache bmp_cache;
|
BitmapCache bmp_cache;
|
||||||
int logo_size = lround(width * 0.25);
|
int logo_size = lround(width * 0.25);
|
||||||
wxBitmap logo_bmp = *bmp_cache.load_svg(wxGetApp().logo_name(), logo_size, logo_size);
|
wxBitmap* logo_bmp_ptr = bmp_cache.load_svg(wxGetApp().logo_name(), logo_size, logo_size);
|
||||||
|
if (logo_bmp_ptr == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxBitmap logo_bmp = *logo_bmp_ptr;
|
||||||
|
|
||||||
wxCoord margin = int(m_scale * 20);
|
wxCoord margin = int(m_scale * 20);
|
||||||
|
|
||||||
|
@ -1684,6 +1684,10 @@ void ImGuiWrapper::init_font(bool compress)
|
|||||||
assert(rect->Width == icon_sz);
|
assert(rect->Width == icon_sz);
|
||||||
assert(rect->Height == icon_sz);
|
assert(rect->Height == icon_sz);
|
||||||
std::vector<unsigned char> raw_data = load_svg(icon.second, icon_sz, icon_sz);
|
std::vector<unsigned char> raw_data = load_svg(icon.second, icon_sz, icon_sz);
|
||||||
|
if (raw_data.empty()) {
|
||||||
|
rect_id++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const ImU32* pIn = (ImU32*)raw_data.data();
|
const ImU32* pIn = (ImU32*)raw_data.data();
|
||||||
for (int y = 0; y < icon_sz; y++) {
|
for (int y = 0; y < icon_sz; y++) {
|
||||||
ImU32* pOut = (ImU32*)pixels + (rect->Y + y) * width + (rect->X);
|
ImU32* pOut = (ImU32*)pixels + (rect->Y + y) * width + (rect->X);
|
||||||
@ -1720,6 +1724,10 @@ void ImGuiWrapper::init_font(bool compress)
|
|||||||
assert(rect->Width == icon_sz);
|
assert(rect->Width == icon_sz);
|
||||||
assert(rect->Height == icon_sz);
|
assert(rect->Height == icon_sz);
|
||||||
std::vector<unsigned char> raw_data = load_svg(icon.second, icon_sz, icon_sz);
|
std::vector<unsigned char> raw_data = load_svg(icon.second, icon_sz, icon_sz);
|
||||||
|
if (raw_data.empty()) {
|
||||||
|
rect_id++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const ImU32* pIn = (ImU32*)raw_data.data();
|
const ImU32* pIn = (ImU32*)raw_data.data();
|
||||||
for (int y = 0; y < icon_sz; y++) {
|
for (int y = 0; y < icon_sz; y++) {
|
||||||
ImU32* pOut = (ImU32*)pixels + (rect->Y + y) * width + (rect->X);
|
ImU32* pOut = (ImU32*)pixels + (rect->Y + y) * width + (rect->X);
|
||||||
|
Loading…
Reference in New Issue
Block a user