GameListItem: Reduce levels of indentation

This commit is contained in:
JosJuice 2017-06-27 11:33:47 +02:00
parent b9499441ee
commit 89716025da
1 changed files with 20 additions and 20 deletions

View File

@ -241,13 +241,13 @@ bool GameListItem::SetWxBannerFromPNGFile(const std::string& path)
void GameListItem::SetWxBannerFromRaw(const Banner& banner) void GameListItem::SetWxBannerFromRaw(const Banner& banner)
{ {
if (banner.empty())
return;
// Need to make explicit copy as wxImage uses reference counting for copies combined with only // Need to make explicit copy as wxImage uses reference counting for copies combined with only
// taking a pointer, not the content, when given a buffer to its constructor. // taking a pointer, not the content, when given a buffer to its constructor.
if (!banner.empty()) m_banner_wx.Create(banner.width, banner.height, false);
{ std::memcpy(m_banner_wx.GetData(), banner.buffer.data(), banner.buffer.size());
m_banner_wx.Create(banner.width, banner.height, false);
std::memcpy(m_banner_wx.GetData(), banner.buffer.data(), banner.buffer.size());
}
} }
bool GameListItem::BannerChanged() bool GameListItem::BannerChanged()
@ -255,21 +255,21 @@ bool GameListItem::BannerChanged()
// Wii banners can only be read if there is a savefile, // Wii banners can only be read if there is a savefile,
// so sometimes caches don't contain banners. Let's check // so sometimes caches don't contain banners. Let's check
// if a banner has become available after the cache was made. // if a banner has become available after the cache was made.
if ((m_platform == DiscIO::Platform::WII_DISC || m_platform == DiscIO::Platform::WII_WAD) &&
m_banner.empty()) if (!m_banner.empty())
{ return false;
auto& banner = m_pending.banner; if (m_platform != DiscIO::Platform::WII_DISC && m_platform != DiscIO::Platform::WII_WAD)
std::vector<u32> buffer = return false;
DiscIO::Volume::GetWiiBanner(&banner.width, &banner.height, m_title_id);
if (buffer.size()) auto& banner = m_pending.banner;
{ std::vector<u32> buffer = DiscIO::Volume::GetWiiBanner(&banner.width, &banner.height, m_title_id);
ReadVolumeBanner(&banner.buffer, buffer, banner.width, banner.height); if (!buffer.size())
// Only reach here if m_banner was empty, so don't need to explicitly compare to see if return false;
// different
return true; ReadVolumeBanner(&banner.buffer, buffer, banner.width, banner.height);
} // We only reach here if m_banner was empty, so we don't need to explicitly
} // compare to see if they are different
return false; return true;
} }
void GameListItem::BannerCommit() void GameListItem::BannerCommit()