Skip to content

Commit

Permalink
optimize calls to updateInfoPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
XenuIsWatching committed May 20, 2021
1 parent c6bbd38 commit 1a0775b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
6 changes: 5 additions & 1 deletion es-app/src/views/gamelist/DetailedGameListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,19 @@ void DetailedGameListView::initMDValues()

void DetailedGameListView::updateInfoPanel()
{
FileData* file = (mList.size() == 0 || mList.isScrolling()) ? NULL : mList.getSelected();
FileData* file = (mList.size() == 0 || (mList.getScrollingVelocity() != 0)) ? NULL : mList.getSelected();

bool fadingOut;
if(file == NULL)
{
LOG(LogDebug) << "DetailedGameListView::updateInfoPanel() : Clearing!";

//mImage.setImage("");
//mDescription.setText("");
fadingOut = true;
}else{
LOG(LogDebug) << "DetailedGameListView::updateInfoPanel() : Drawing!";

mThumbnail.setImage(file->getThumbnailPath());
mMarquee.setImage(file->getMarqueePath());
mImage.setImage(file->getImagePath());
Expand Down
4 changes: 4 additions & 0 deletions es-app/src/views/gamelist/GridGameListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,17 @@ void GridGameListView::updateInfoPanel()
bool fadingOut;
if(file == NULL)
{
LOG(LogDebug) << "GridGameListView::updateInfoPanel() : Clearing!";

mVideo->setVideo("");
mVideo->setImage("");
mVideoPlaying = false;

//mDescription.setText("");
fadingOut = true;
}else{
LOG(LogDebug) << "GridGameListView::updateInfoPanel() : Drawing!";

if (!mVideo->setVideo(file->getVideoPath()))
{
mVideo->setDefaultVideo();
Expand Down
6 changes: 5 additions & 1 deletion es-app/src/views/gamelist/VideoGameListView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,13 @@ void VideoGameListView::initMDValues()

void VideoGameListView::updateInfoPanel()
{
FileData* file = (mList.size() == 0 || mList.isScrolling()) ? NULL : mList.getSelected();
FileData* file = (mList.size() == 0 || (mList.getScrollingVelocity() != 0)) ? NULL : mList.getSelected();

bool fadingOut;
if(file == NULL)
{
LOG(LogDebug) << "VideoGameListView::updateInfoPanel() : Clearing!";

mVideo->setVideo("");
mVideo->setImage("");
mVideoPlaying = false;
Expand All @@ -259,6 +261,8 @@ void VideoGameListView::updateInfoPanel()
fadingOut = true;

}else{
LOG(LogDebug) << "VideoGameListView::updateInfoPanel() : Drawing!";

if (!mVideo->setVideo(file->getVideoPath()))
{
mVideo->setDefaultVideo();
Expand Down
14 changes: 5 additions & 9 deletions es-core/src/components/IList.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ class IList : public GuiComponent
};

protected:
int mCursor;
int mCursor; //This is the current position in the list

int mScrollTier;
int mScrollVelocity;
int mScrollTier; //This lists the the scrolling "speed gear"
int mScrollVelocity; //This is the the steps/interval and direction (-/+)

int mScrollTierAccumulator;
int mScrollTierAccumulator; //This counts until it needs to switch to higher gear
int mScrollCursorAccumulator;

unsigned char mTitleOverlayOpacity;
Expand Down Expand Up @@ -191,10 +191,6 @@ class IList : public GuiComponent
{
PowerSaver::setState(velocity == 0);

// generate an onCursorChanged event in the stopped state when the user lets go of the key
if(velocity == 0 && mScrollVelocity != 0)
onCursorChanged(CURSOR_STOPPED);

mScrollVelocity = velocity;
mScrollTier = 0;
mScrollTierAccumulator = 0;
Expand Down Expand Up @@ -302,7 +298,7 @@ class IList : public GuiComponent
onScroll(absAmt);

mCursor = cursor;
onCursorChanged((mScrollTier > 0) ? CURSOR_SCROLLING : CURSOR_STOPPED);
onCursorChanged((amt != 0) ? CURSOR_SCROLLING : CURSOR_STOPPED);
}

virtual void onCursorChanged(const CursorState& /*state*/) {}
Expand Down

0 comments on commit 1a0775b

Please sign in to comment.