mirror of https://github.com/BOINC/boinc.git
Compatibility fix for wxWidgets 3.1.5 wxBitmapCombo Box, which requires all bitmaps in a combo box to be the same size.
This commit is contained in:
parent
05a9ddab3b
commit
56ac9416fb
|
@ -551,30 +551,28 @@ wxBitmap* CSimpleProjectPanel::GetProjectSpecificBitmap(char* project_url) {
|
||||||
wxBitmap* projectBM;
|
wxBitmap* projectBM;
|
||||||
wxString strIconPath = wxString(defaultIcnPath,wxConvUTF8);
|
wxString strIconPath = wxString(defaultIcnPath,wxConvUTF8);
|
||||||
if (wxFile::Exists(strIconPath)) {
|
if (wxFile::Exists(strIconPath)) {
|
||||||
|
// wxBitmapComboBox requires all its bitmaps to be the same size
|
||||||
|
// Our "project icon" bitmaps should all be 40 X 40
|
||||||
|
wxImage img = wxImage(strIconPath, wxBITMAP_TYPE_ANY);
|
||||||
|
if (img.IsOk()) {
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
if ((GetXDPIScaling() > 1.05) || (GetYDPIScaling() > 1.05)) {
|
if ((GetXDPIScaling() > 1.05) || (GetYDPIScaling() > 1.05)) {
|
||||||
wxImage img = wxImage(strIconPath, wxBITMAP_TYPE_ANY);
|
img.Rescale((int) (40*GetXDPIScaling()),
|
||||||
if (img.IsOk()) {
|
(int) (40*GetYDPIScaling()),
|
||||||
img.Rescale((int) (img.GetWidth()*GetXDPIScaling()),
|
wxIMAGE_QUALITY_BILINEAR
|
||||||
(int) (img.GetHeight()*GetYDPIScaling()),
|
);
|
||||||
wxIMAGE_QUALITY_BILINEAR
|
}
|
||||||
);
|
#else
|
||||||
projectBM = new wxBitmap(img);
|
if ((img.GetHeight() != 40) || (img.GetWidth() == 40)) {
|
||||||
if (projectBM->IsOk()) {
|
img.Rescale(40, 40, wxIMAGE_QUALITY_BILINEAR);
|
||||||
return projectBM;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
{
|
projectBM = new wxBitmap(img);
|
||||||
projectBM = new wxBitmap();
|
if (projectBM->IsOk()) {
|
||||||
if ( projectBM->LoadFile(strIconPath, wxBITMAP_TYPE_ANY) ) {
|
|
||||||
return projectBM;
|
return projectBM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pSkinSimple->GetProjectImage()->GetBitmap();
|
return pSkinSimple->GetProjectImage()->GetBitmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue