OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/display/output_configurator.h" | 5 #include "chromeos/display/output_configurator.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <X11/extensions/Xrandr.h> | 8 #include <X11/extensions/Xrandr.h> |
9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
10 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 return true; | 162 return true; |
163 } else { | 163 } else { |
164 return false; | 164 return false; |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 // static | 168 // static |
169 const OutputConfigurator::ModeInfo* OutputConfigurator::GetModeInfo( | 169 const OutputConfigurator::ModeInfo* OutputConfigurator::GetModeInfo( |
170 const OutputSnapshot& output, | 170 const OutputSnapshot& output, |
171 RRMode mode) { | 171 RRMode mode) { |
| 172 if (mode == None) |
| 173 return NULL; |
| 174 |
172 std::map<RRMode, ModeInfo>::const_iterator it = output.mode_infos.find(mode); | 175 std::map<RRMode, ModeInfo>::const_iterator it = output.mode_infos.find(mode); |
173 if (it == output.mode_infos.end()) { | 176 if (it == output.mode_infos.end()) { |
174 LOG(WARNING) << "Unable to find info about mode " << mode | 177 LOG(WARNING) << "Unable to find info about mode " << mode |
175 << " for output " << output.output; | 178 << " for output " << output.output; |
176 return NULL; | 179 return NULL; |
177 } | 180 } |
178 return &it->second; | 181 return &it->second; |
179 } | 182 } |
180 | 183 |
181 OutputConfigurator::OutputConfigurator() | 184 OutputConfigurator::OutputConfigurator() |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 float width_ratio = static_cast<float>(mirror_mode_info->width) / | 699 float width_ratio = static_cast<float>(mirror_mode_info->width) / |
697 static_cast<float>(native_mode_info->width); | 700 static_cast<float>(native_mode_info->width); |
698 float height_ratio = static_cast<float>(mirror_mode_info->height) / | 701 float height_ratio = static_cast<float>(mirror_mode_info->height) / |
699 static_cast<float>(native_mode_info->height); | 702 static_cast<float>(native_mode_info->height); |
700 | 703 |
701 area_ratio = width_ratio * height_ratio; | 704 area_ratio = width_ratio * height_ratio; |
702 return area_ratio; | 705 return area_ratio; |
703 } | 706 } |
704 | 707 |
705 } // namespace chromeos | 708 } // namespace chromeos |
OLD | NEW |