summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2015-09-30 21:12:12 +0200
committerJosJuice <josjuice@gmail.com>2015-09-30 21:31:20 +0200
commitdec142cd00e0f5d81a01ab9d85e86ca613bbcfb7 (patch)
tree8995c6db29c9339942d42179a1ecf49239396860 /Source/Core
parent7fdfea5a6935fd0293fcb3b51790019b9adeedf7 (diff)
DolphinWX: Respect aspect ratio of banners
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/ISOFile.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/Core/DolphinWX/ISOFile.cpp b/Source/Core/DolphinWX/ISOFile.cpp
index ed993cd1cb..4757334778 100644
--- a/Source/Core/DolphinWX/ISOFile.cpp
+++ b/Source/Core/DolphinWX/ISOFile.cpp
@@ -278,10 +278,14 @@ bool GameListItem::ReadPNGBanner(const std::string& path)
wxBitmap GameListItem::ScaleBanner(wxImage* image)
{
- double scale = wxTheApp->GetTopWindow()->GetContentScaleFactor();
- image->Rescale(DVD_BANNER_WIDTH * scale, DVD_BANNER_HEIGHT * scale, wxIMAGE_QUALITY_HIGH);
+ 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