summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/ISOFile.cpp
diff options
context:
space:
mode:
authorshuffle2 <godisgovernment@gmail.com>2016-10-03 20:06:08 -0700
committerGitHub <noreply@github.com>2016-10-03 20:06:08 -0700
commitb8731eb8180d76b4663eaf4188f985b9c5fa6fb2 (patch)
tree40f57e85be3073d528e9e5a5776a905170a3a7ac /Source/Core/DolphinWX/ISOFile.cpp
parent4573cc89fa65a867f991c1e592ad47382f1ee0a5 (diff)
parentc4f5ced37ca9eff6a5c62c08f1cc7a9e6dc47f7d (diff)
Merge pull request #4068 from EmptyChaos/wx-hidpi
WX: Comprehensive HiDPI Patch
Diffstat (limited to 'Source/Core/DolphinWX/ISOFile.cpp')
-rw-r--r--Source/Core/DolphinWX/ISOFile.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp
index 1b986c02c6..05379a98a8 100644
--- a/Source/Core/DolphinWX/ISOFile.cpp
+++ b/Source/Core/DolphinWX/ISOFile.cpp
@@ -38,9 +38,6 @@
static const u32 CACHE_REVISION = 0x127; // Last changed in PR 3309
-#define DVD_BANNER_WIDTH 96
-#define DVD_BANNER_HEIGHT 32
-
static std::string GetLanguageString(DiscIO::Language language,
std::map<DiscIO::Language, std::string> strings)
{
@@ -165,13 +162,12 @@ GameListItem::GameListItem(const std::string& _rFileName,
// Volume banner. Typical for everything that isn't a DOL or ELF.
if (!m_pImage.empty())
{
- wxImage image(m_ImageWidth, m_ImageHeight, &m_pImage[0], true);
- m_Bitmap = ScaleBanner(&image);
+ // 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.
+ m_image.Create(m_ImageWidth, m_ImageHeight, false);
+ std::memcpy(m_image.GetData(), m_pImage.data(), m_pImage.size());
return;
}
-
- // Fallback in case no banner is available.
- ReadPNGBanner(File::GetSysDirectory() + RESOURCES_DIR + DIR_SEP + "nobanner.png");
}
GameListItem::~GameListItem()
@@ -277,25 +273,11 @@ bool GameListItem::ReadPNGBanner(const std::string& path)
return false;
wxImage image(StrToWxStr(path), wxBITMAP_TYPE_PNG);
- m_Bitmap = ScaleBanner(&image);
- return true;
-}
+ if (!image.IsOk())
+ return false;
-wxBitmap GameListItem::ScaleBanner(wxImage* image)
-{
- const double gui_scale = wxTheApp->GetTopWindow()->GetContentScaleFactor();
- const double target_width = DVD_BANNER_WIDTH * gui_scale;
- const double target_height = DVD_BANNER_HEIGHT * gui_scale;
- const double banner_scale =
- std::min(target_width / image->GetWidth(), target_height / image->GetHeight());
- image->Rescale(image->GetWidth() * banner_scale, image->GetHeight() * banner_scale,
- wxIMAGE_QUALITY_HIGH);
- image->Resize(wxSize(target_width, target_height), wxPoint(), 0xFF, 0xFF, 0xFF);
-#ifdef __APPLE__
- return wxBitmap(*image, -1, gui_scale);
-#else
- return wxBitmap(*image, -1);
-#endif
+ m_image = image;
+ return true;
}
std::string GameListItem::GetDescription(DiscIO::Language language) const