use oss-nvjpg for loading jpeg images (homebrew, games and themezer).

slightly faster loading on avg compared to stbi.
This commit is contained in:
ITotalJustice
2025-06-02 22:18:38 +01:00
parent 8485ff1e99
commit 4be1d48215
10 changed files with 146 additions and 43 deletions

View File

@@ -13,6 +13,7 @@
#include "i18n.hpp"
#include "download.hpp"
#include "dumper.hpp"
#include "image.hpp"
#include <cstring>
#include <algorithm>
@@ -965,7 +966,13 @@ void Menu::OnChangeIndex(s64 new_index) {
const auto& e = m_entries[m_entry_index];
const auto jpeg_size = e.control_size - sizeof(NacpStruct);
m_icon = nvgCreateImageMem(App::GetVg(), 0, e.control->icon, jpeg_size);
TimeStamp ts;
const auto image = ImageLoadFromMemory({e.control->icon, jpeg_size}, ImageFlag_JPEG);
if (!image.data.empty()) {
m_icon = nvgCreateImageRGBA(App::GetVg(), image.w, image.h, 0, image.data.data());
log_write("\t[image load] time taken: %.2fs %zums\n", ts.GetSecondsD(), ts.GetMs());
}
}
}