[UI] Free image data from stbi_load
This commit is contained in:
@@ -289,9 +289,13 @@ std::unique_ptr<ImmediateTexture> ImGuiDrawer::LoadImGuiIcon(
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return immediate_drawer_->CreateTexture(
|
auto texture = immediate_drawer_->CreateTexture(
|
||||||
width, height, ImmediateTextureFilter::kLinear, true,
|
width, height, ImmediateTextureFilter::kLinear, true,
|
||||||
reinterpret_cast<uint8_t*>(image_data));
|
reinterpret_cast<uint8_t*>(image_data));
|
||||||
|
|
||||||
|
stbi_image_free(image_data);
|
||||||
|
|
||||||
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<uint32_t, std::unique_ptr<ImmediateTexture>> ImGuiDrawer::LoadIcons(
|
std::map<uint32_t, std::unique_ptr<ImmediateTexture>> ImGuiDrawer::LoadIcons(
|
||||||
@@ -328,6 +332,8 @@ void ImGuiDrawer::SetupNotificationTextures() {
|
|||||||
notification_icon_textures_.push_back(immediate_drawer_->CreateTexture(
|
notification_icon_textures_.push_back(immediate_drawer_->CreateTexture(
|
||||||
width, height, ImmediateTextureFilter::kLinear, true,
|
width, height, ImmediateTextureFilter::kLinear, true,
|
||||||
reinterpret_cast<uint8_t*>(image_data)));
|
reinterpret_cast<uint8_t*>(image_data)));
|
||||||
|
|
||||||
|
stbi_image_free(image_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,6 +574,8 @@ void ImGuiDrawer::SetImmediateDrawer(ImmediateDrawer* new_immediate_drawer) {
|
|||||||
locked_achievement_icon_ = immediate_drawer_->CreateTexture(
|
locked_achievement_icon_ = immediate_drawer_->CreateTexture(
|
||||||
width, height, ImmediateTextureFilter::kLinear, true,
|
width, height, ImmediateTextureFilter::kLinear, true,
|
||||||
reinterpret_cast<uint8_t*>(image_data));
|
reinterpret_cast<uint8_t*>(image_data));
|
||||||
|
|
||||||
|
stbi_image_free(image_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user