summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/ISOFile.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2015-12-02 13:59:13 +0100
committerMarkus Wick <degasus@users.noreply.github.com>2015-12-02 13:59:13 +0100
commit4a40e7b40534bba3da4939c0060ee4f35cc59125 (patch)
tree286ccfce57d158ae11c225c692b179c78f78d6b8 /Source/Core/DolphinWX/ISOFile.cpp
parent3dcfb7d71c229f65c636498bbc84d1897b94327a (diff)
parentdec142cd00e0f5d81a01ab9d85e86ca613bbcfb7 (diff)
Merge pull request #3111 from JosJuice/wx-banner-scaling
DolphinWX: Improve HBC banner scaling
Diffstat (limited to 'Source/Core/DolphinWX/ISOFile.cpp')
-rw-r--r--Source/Core/DolphinWX/ISOFile.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp
index a63a64d019..3bdb41afec 100644
--- a/Source/Core/DolphinWX/ISOFile.cpp
+++ b/Source/Core/DolphinWX/ISOFile.cpp
@@ -271,13 +271,14 @@ bool GameListItem::ReadPNGBanner(const std::string& path)
wxBitmap GameListItem::ScaleBanner(wxImage* image)
{
- double scale = wxTheApp->GetTopWindow()->GetContentScaleFactor();
- // Note: This uses nearest neighbor, which subjectively looks a lot
- // better for GC banners than smooth scaling.
- // TODO: Make scaling less bad for Homebrew Channel banners.
- image->Rescale(DVD_BANNER_WIDTH * scale, DVD_BANNER_HEIGHT * scale);
+ 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, scale);
+ return wxBitmap(*image, -1, gui_scale);
#else
return wxBitmap(*image, -1);
#endif