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

Unified Diff: ash/display/display_change_observer_chromeos.cc

Issue 138903025: Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 041e3518 Cleaned up. Created 6 years, 11 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
Index: ash/display/display_change_observer_chromeos.cc
diff --git a/ash/display/display_change_observer_chromeos.cc b/ash/display/display_change_observer_chromeos.cc
index 7c5780ec639259df80a29f85ee6698482fa9985f..7da0c679c611d06455605b909ace4fa054da1f71 100644
--- a/ash/display/display_change_observer_chromeos.cc
+++ b/ash/display/display_change_observer_chromeos.cc
@@ -41,7 +41,9 @@ const float kInchInMm = 25.4f;
// one comes first.
struct ResolutionSorter {
bool operator()(const Resolution& a, const Resolution& b) {
- return a.size.width() * a.size.height() > b.size.width() * b.size.height();
+ if (a.size.GetArea() == b.size.GetArea())
+ return (a.refresh_rate > b.refresh_rate);
+ return (a.size.GetArea() > b.size.GetArea());
}
};
@@ -58,6 +60,7 @@ std::vector<Resolution> DisplayChangeObserver::GetResolutionList(
const OutputConfigurator::ModeInfo& mode_info = it->second;
const std::pair<int, int> size(mode_info.width, mode_info.height);
const Resolution resolution(gfx::Size(mode_info.width, mode_info.height),
+ mode_info.refresh_rate,
mode_info.interlaced);
// Add the resolution if it isn't already present and override interlaced
@@ -104,10 +107,14 @@ chromeos::OutputState DisplayChangeObserver::GetStateForDisplayIds(
bool DisplayChangeObserver::GetResolutionForDisplayId(int64 display_id,
int* width,
- int* height) const {
+ int* height,
+ float* refresh_rate)
+ const {
gfx::Size resolution;
- if (!Shell::GetInstance()->display_manager()->
- GetSelectedResolutionForDisplayId(display_id, &resolution)) {
+ if (!Shell::GetInstance()
+ ->display_manager()
+ ->GetSelectedResolutionForDisplayId(
+ display_id, &resolution, refresh_rate)) {
return false;
}
@@ -145,9 +152,7 @@ void DisplayChangeObserver::OnDisplayModeChanged(
gfx::Rect display_bounds(
output.x, output.y, mode_info->width, mode_info->height);
- std::vector<Resolution> resolutions;
- if (output.type != chromeos::OUTPUT_TYPE_INTERNAL)
- resolutions = GetResolutionList(output);
+ std::vector<Resolution> resolutions = GetResolutionList(output);
std::string name = output.type == chromeos::OUTPUT_TYPE_INTERNAL ?
l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) :

Powered by Google App Engine
This is Rietveld 408576698