Merge pull request #3111 from JosJuice/wx-banner-scaling

DolphinWX: Improve HBC banner scaling
This commit is contained in:
Markus Wick 2015-12-02 13:59:13 +01:00
commit 4a40e7b405

View File

@ -271,13 +271,14 @@ bool GameListItem::ReadPNGBanner(const std::string& path)
wxBitmap GameListItem::ScaleBanner(wxImage* image) wxBitmap GameListItem::ScaleBanner(wxImage* image)
{ {
double scale = wxTheApp->GetTopWindow()->GetContentScaleFactor(); const double gui_scale = wxTheApp->GetTopWindow()->GetContentScaleFactor();
// Note: This uses nearest neighbor, which subjectively looks a lot const double target_width = DVD_BANNER_WIDTH * gui_scale;
// better for GC banners than smooth scaling. const double target_height = DVD_BANNER_HEIGHT * gui_scale;
// TODO: Make scaling less bad for Homebrew Channel banners. const double banner_scale = std::min(target_width / image->GetWidth(), target_height / image->GetHeight());
image->Rescale(DVD_BANNER_WIDTH * scale, DVD_BANNER_HEIGHT * scale); 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__ #ifdef __APPLE__
return wxBitmap(*image, -1, scale); return wxBitmap(*image, -1, gui_scale);
#else #else
return wxBitmap(*image, -1); return wxBitmap(*image, -1);
#endif #endif