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.
4
5#include "ui/ozone/common/chromeos/display_util.h"
6
7#include "ui/display/types/display_mode.h"
8#include "ui/display/types/display_snapshot.h"
9
10namespace ui {
11
12DisplayMode_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();
17
18  return params;
19}
20
21DisplaySnapshot_Params GetDisplaySnapshotParams(
22    const DisplaySnapshot& display) {
23  DisplaySnapshot_Params params;
24  params.display_id = display.display_id();
25  params.has_proper_display_id = display.has_proper_display_id();
26  params.origin = display.origin();
27  params.physical_size = display.physical_size();
28  params.type = display.type();
29  params.is_aspect_preserving_scaling = display.is_aspect_preserving_scaling();
30  params.has_overscan = display.has_overscan();
31  params.display_name = display.display_name();
32  for (size_t i = 0; i < display.modes().size(); ++i)
33    params.modes.push_back(GetDisplayModeParams(*display.modes()[i]));
34
35  params.has_current_mode = display.current_mode() != NULL;
36  if (params.has_current_mode)
37    params.current_mode = GetDisplayModeParams(*display.current_mode());
38
39  params.has_native_mode = display.native_mode() != NULL;
40  if (params.has_native_mode)
41    params.native_mode = GetDisplayModeParams(*display.native_mode());
42
43  params.string_representation = display.ToString();
44
45  return params;
46}
47
48}  // namespace ui
49