Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: resolution_selector.cc

Issue 6732013: Refactor monitor_reconfigure to stop using system("xrandr"). (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/monitor_reconfig.git@master
Patch Set: Fix comment Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « resolution_selector.h ('k') | resolution_selector_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: resolution_selector.cc
diff --git a/resolution_selector.cc b/resolution_selector.cc
index e13b0e0fe6a94e500388321fc81c181043f80026..52a7da390fcee7d0dc757fb37e594b274e10a109 100644
--- a/resolution_selector.cc
+++ b/resolution_selector.cc
@@ -18,16 +18,16 @@ const int ResolutionSelector::kMaxProjectorPixels = 1280 * 720;
bool ResolutionSelector::FindBestResolutions(
const vector<Mode>& lcd_modes,
const vector<Mode>& external_modes,
- string* lcd_resolution,
- string* external_resolution,
- string* screen_resolution) {
+ Mode* lcd_resolution,
+ Mode* external_resolution,
+ Mode* screen_resolution) {
DCHECK(!lcd_modes.empty());
// If there's no external display, just use the highest resolution
// available from the LCD.
if (external_modes.empty()) {
- *lcd_resolution = *screen_resolution = lcd_modes[0].name;
- external_resolution->clear();
+ *lcd_resolution = *screen_resolution = lcd_modes[0];
+ external_resolution->name.clear();
return true;
}
@@ -45,8 +45,8 @@ bool ResolutionSelector::FindBestResolutions(
// forget about trying to choose a screen size that'll fit on the
// built-in display.
if (max_external_size > kMaxProjectorPixels) {
- *external_resolution = *screen_resolution = external_modes[0].name;
- lcd_resolution->clear();
+ *external_resolution = *screen_resolution = external_modes[0];
+ lcd_resolution->name.clear();
return true;
}
return FindNearestResolutions(
@@ -58,9 +58,9 @@ bool ResolutionSelector::FindBestResolutions(
bool ResolutionSelector::FindNearestResolutions(
const vector<Mode>& larger_device_modes,
const vector<Mode>& smaller_device_modes,
- std::string* larger_resolution,
- std::string* smaller_resolution,
- std::string* screen_resolution) {
+ Mode* larger_resolution,
+ Mode* smaller_resolution,
+ Mode* screen_resolution) {
DCHECK(!larger_device_modes.empty());
DCHECK(!smaller_device_modes.empty());
DCHECK(larger_resolution);
@@ -68,7 +68,7 @@ bool ResolutionSelector::FindNearestResolutions(
DCHECK(screen_resolution);
// Start with the best that the smaller device has to offer.
- *smaller_resolution = smaller_device_modes[0].name;
+ *smaller_resolution = smaller_device_modes[0];
*screen_resolution = *smaller_resolution;
int smaller_width = smaller_device_modes[0].width;
int smaller_height = smaller_device_modes[0].height;
@@ -77,14 +77,14 @@ bool ResolutionSelector::FindNearestResolutions(
larger_device_modes.rbegin();
it != larger_device_modes.rend(); ++it) {
if (it->width >= smaller_width && it->height >= smaller_height) {
- *larger_resolution = it->name;
+ *larger_resolution = *it;
return true;
}
}
LOG(WARNING) << "Failed to find a resolution from larger device "
<< "exceeding chosen resolution from smaller device ("
- << *smaller_resolution << ")";
+ << smaller_resolution->name << ")";
return false;
}
« no previous file with comments | « resolution_selector.h ('k') | resolution_selector_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698