Merge pull request #151 from aquileia/clean_up
Fix resolution selection dialog
This commit is contained in:
commit
8cb1e4f989
2 changed files with 11 additions and 8 deletions
|
@ -283,9 +283,6 @@ bool show_video_mode_dialog(display& disp)
|
|||
|
||||
for(size_t k = 0; k < resolutions.size(); ++k) {
|
||||
std::pair<int, int> const& res = resolutions[k];
|
||||
if(res.first < min_allowed_width() || res.second < min_allowed_height()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (res == current_res)
|
||||
current_choice = static_cast<unsigned>(k);
|
||||
|
@ -293,8 +290,9 @@ bool show_video_mode_dialog(display& disp)
|
|||
std::ostringstream option;
|
||||
option << res.first << utils::unicode_multiplication_sign << res.second;
|
||||
const int div = boost::math::gcd(res.first, res.second);
|
||||
if (div >= 10)
|
||||
option << " (" << res.first/div << ':' << res.second/div << ')';
|
||||
const int ratio[2] = {res.first/div, res.second/div};
|
||||
if (ratio[0] <= 10 || ratio[1] <= 10)
|
||||
option << " (" << ratio[0] << ':' << ratio[1] << ')';
|
||||
options.push_back(option.str());
|
||||
}
|
||||
|
||||
|
|
|
@ -611,10 +611,15 @@ std::vector<std::pair<int, int> > CVideo::get_available_resolutions()
|
|||
std::cerr << "No modes supported\n";
|
||||
return result;
|
||||
}
|
||||
|
||||
result.push_back(std::make_pair(getSurface()->w, getSurface()->h));
|
||||
|
||||
const std::pair<int,int> min_res = std::make_pair(preferences::min_allowed_width(),preferences::min_allowed_height());
|
||||
|
||||
if (getSurface()->w >= min_res.first && getSurface()->h >= min_res.second)
|
||||
result.push_back(std::make_pair(getSurface()->w, getSurface()->h));
|
||||
|
||||
for(int i = 0; modes[i] != NULL; ++i) {
|
||||
result.push_back(std::make_pair(modes[i]->w,modes[i]->h));
|
||||
if (modes[i]->w >= min_res.first && modes[i]->h >= min_res.second)
|
||||
result.push_back(std::make_pair(modes[i]->w,modes[i]->h));
|
||||
}
|
||||
|
||||
std::sort(result.begin(), result.end());
|
||||
|
|
Loading…
Add table
Reference in a new issue