Eliminated some unnecessary carousel on-demand texture loading.

This commit is contained in:
Leon Styhre 2022-09-22 20:11:37 +02:00
parent 04473d0ff3
commit f620df4dff
2 changed files with 11 additions and 4 deletions

View file

@ -433,18 +433,25 @@ void GamelistView::updateView(const CursorState& state)
return;
}
bool loadedTexture {false};
if (mCarousel != nullptr && mCarousel->isScrolling()) {
mCarousel->onDemandTextureLoad();
loadedTexture = true;
}
FileData* file {(mPrimary->size() > 0 && state == CursorState::CURSOR_STOPPED) ?
mPrimary->getSelected() :
nullptr};
if (mCarousel != nullptr)
mCarousel->onDemandTextureLoad();
// If the game data has already been rendered to the view, then skip it this time.
// This also happens when fast-scrolling.
if (file == mLastUpdated)
return;
if (mCarousel != nullptr && !loadedTexture)
mCarousel->onDemandTextureLoad();
if (state == CursorState::CURSOR_STOPPED)
mLastUpdated = file;

View file

@ -58,6 +58,7 @@ public:
void setItemType(std::string itemType) { mItemType = itemType; }
const std::string& getDefaultItem() { return mDefaultItem; }
void setDefaultItem(std::string defaultItem) { mDefaultItem = defaultItem; }
bool isScrolling() const override { return List::isScrolling(); }
void setCursorChangedCallback(const std::function<void(CursorState state)>& func) override
{
@ -83,7 +84,6 @@ private:
NavigationSounds::getInstance().playThemeNavigationSound(SYSTEMBROWSESOUND);
}
bool isScrolling() const override { return List::isScrolling(); }
void stopScrolling() override
{
List::stopScrolling();