Skip to content

Commit

Permalink
Load preset palettes faster
Browse files Browse the repository at this point in the history
Load all queued resources on each onTick() instead of one per tick.
  • Loading branch information
dacap committed May 30, 2017
1 parent f1454da commit 399314b
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/app/ui/resources_listbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,22 +177,20 @@ void ResourcesListBox::onTick()
base::UniquePtr<Resource> resource;
std::string name;

if (!m_resourcesLoader->next(resource)) {
if (m_resourcesLoader->isDone()) {
stop();
}
return;
}
while (m_resourcesLoader->next(resource)) {
base::UniquePtr<ResourceListItem> listItem(onCreateResourceItem(resource));
insertChild(getItemsCount()-1, listItem);
layout();

base::UniquePtr<ResourceListItem> listItem(onCreateResourceItem(resource));
insertChild(getItemsCount()-1, listItem);
layout();
if (View* view = View::getView(this))
view->updateView();

if (View* view = View::getView(this))
view->updateView();
resource.release();
listItem.release();
}

resource.release();
listItem.release();
if (m_resourcesLoader->isDone())
stop();
}

void ResourcesListBox::stop()
Expand Down

0 comments on commit 399314b

Please sign in to comment.