Roll src/third_party/WebKit 6f84130:7353389 (svn 184386:184391)
[chromium-blink-merge.git] / ui / ozone / common / display_util.cc
blob8db7c3a68712fd9865cbd07cc1fba3b025c5086d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/ozone/common/display_util.h"
7 #include "ui/display/types/display_mode.h"
8 #include "ui/display/types/display_snapshot.h"
10 namespace ui {
12 DisplayMode_Params GetDisplayModeParams(const DisplayMode& mode) {
13 DisplayMode_Params params;
14 params.size = mode.size();
15 params.is_interlaced = mode.is_interlaced();
16 params.refresh_rate = mode.refresh_rate();
18 return params;
21 DisplaySnapshot_Params GetDisplaySnapshotParams(
22 const DisplaySnapshot& display) {
23 DisplaySnapshot_Params params;
24 params.display_id = display.display_id();
25 params.origin = display.origin();
26 params.physical_size = display.physical_size();
27 params.type = display.type();
28 params.is_aspect_preserving_scaling = display.is_aspect_preserving_scaling();
29 params.has_overscan = display.has_overscan();
30 params.display_name = display.display_name();
31 for (size_t i = 0; i < display.modes().size(); ++i)
32 params.modes.push_back(GetDisplayModeParams(*display.modes()[i]));
34 params.has_current_mode = display.current_mode() != NULL;
35 if (params.has_current_mode)
36 params.current_mode = GetDisplayModeParams(*display.current_mode());
38 params.has_native_mode = display.native_mode() != NULL;
39 if (params.has_native_mode)
40 params.native_mode = GetDisplayModeParams(*display.native_mode());
42 params.string_representation = display.ToString();
44 return params;
47 } // namespace ui