Set forceloading of all images for the startup system to avoid texture pop-in.

This commit is contained in:
Leon Styhre 2022-09-10 16:07:43 +02:00
parent c50f39dd05
commit d2641d5c2c
2 changed files with 17 additions and 2 deletions

View file

@ -104,6 +104,9 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
return; return;
} }
const bool isStartupSystem {Settings::getInstance()->getString("StartupSystem") ==
mRoot->getSystem()->getName()};
using namespace ThemeFlags; using namespace ThemeFlags;
if (mTheme->hasView("gamelist")) { if (mTheme->hasView("gamelist")) {
@ -169,6 +172,10 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
addChild(mPrimary); addChild(mPrimary);
} }
if (element.second.type == "image") { if (element.second.type == "image") {
// If this is the startup system, then forceload the images to avoid texture pop-in.
if (isStartupSystem)
mImageComponents.push_back(std::make_unique<ImageComponent>(true));
else
mImageComponents.push_back(std::make_unique<ImageComponent>()); mImageComponents.push_back(std::make_unique<ImageComponent>());
mImageComponents.back()->setDefaultZIndex(30.0f); mImageComponents.back()->setDefaultZIndex(30.0f);
mImageComponents.back()->applyTheme(theme, "gamelist", element.first, ALL); mImageComponents.back()->applyTheme(theme, "gamelist", element.first, ALL);

View file

@ -472,7 +472,15 @@ void SystemView::populate()
} }
} }
else if (element.second.type == "image") { else if (element.second.type == "image") {
elements.imageComponents.emplace_back(std::make_unique<ImageComponent>()); // If this is the first system, then forceload the images to avoid texture
// pop-in.
if (it == SystemData::sSystemVector.front())
elements.imageComponents.emplace_back(
std::make_unique<ImageComponent>(true));
else
elements.imageComponents.emplace_back(
std::make_unique<ImageComponent>());
elements.imageComponents.back()->setDefaultZIndex(30.0f); elements.imageComponents.back()->setDefaultZIndex(30.0f);
elements.imageComponents.back()->applyTheme(theme, "system", element.first, elements.imageComponents.back()->applyTheme(theme, "system", element.first,
ThemeFlags::ALL); ThemeFlags::ALL);