Chromium Code Reviews| Index: chromeos/display/output_configurator.cc |
| diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc |
| index 67da273b64965469c0b9d252e2e64e3c8ab16158..3e2c836ffbdd2dc3891380983a54500dcda4db1e 100644 |
| --- a/chromeos/display/output_configurator.cc |
| +++ b/chromeos/display/output_configurator.cc |
| @@ -943,7 +943,7 @@ bool OutputConfigurator::EnterState( |
| DCHECK_EQ(cached_outputs_.size(), updated_outputs.size()); |
| if (!updated_outputs.empty()) { |
| delegate_->CreateFrameBuffer(width, height, updated_outputs); |
| - for (size_t i = 0; i < updated_outputs.size(); ++i) { |
| + for (size_t i = 0; i < updated_outputs.size(); ) { |
|
Daniel Erat
2013/12/21 14:25:54
please structure this code in a more logical way:
|
| const OutputSnapshot& output = updated_outputs[i]; |
| if (delegate_->ConfigureCrtc(output.crtc, output.current_mode, |
| output.output, output.x, output.y)) { |
| @@ -956,7 +956,24 @@ bool OutputConfigurator::EnterState( |
| << " output=" << output.output |
| << " x=" << output.x |
| << " y=" << output.y; |
| + |
| + int best_mode_pixels = 0; |
| + const ModeInfo mode_info = |
| + output.mode_infos.find(output.current_mode)->second; |
|
Daniel Erat
2013/12/21 14:25:54
indent 4 spaces, not 7
|
| + int pixels = mode_info.width * mode_info.height; |
|
Daniel Erat
2013/12/21 14:25:54
give this a better name like current_mode_pixels
|
| + for (ModeInfoMap::const_iterator it = output.mode_infos.begin(); |
| + it != output.mode_infos.end(); it++) { |
| + int pixel_count = it->second.width * it->second.height; |
| + if ((pixel_count < pixels) && (pixel_count > best_mode_pixels)) { |
| + updated_outputs[i].current_mode = it->first; |
| + best_mode_pixels = pixel_count; |
| + } |
| + } |
|
marcheu
2013/12/21 01:56:15
If we are in mirror mode, and modeset fails on one
|
| + |
| + if (best_mode_pixels != 0) |
| + continue; |
|
Daniel Erat
2013/12/21 14:25:54
indent 2 spaces, not 0
|
| } |
| + i++; |
| } |
| } |