base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON().
[chromium-blink-merge.git] / ui / ozone / common / display_snapshot_proxy.cc
blob4bc9e247ed7c3cd4d7a0e37c1c265209e6419431
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_snapshot_proxy.h"
7 #include "ui/ozone/common/display_mode_proxy.h"
8 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
10 namespace ui {
12 namespace {
14 bool SameModes(const DisplayMode_Params& lhs, const DisplayMode_Params& rhs) {
15 return lhs.size == rhs.size && lhs.is_interlaced == rhs.is_interlaced &&
16 lhs.refresh_rate == rhs.refresh_rate;
19 } // namespace
21 DisplaySnapshotProxy::DisplaySnapshotProxy(const DisplaySnapshot_Params& params)
22 : DisplaySnapshot(params.display_id,
23 params.origin,
24 params.physical_size,
25 params.type,
26 params.is_aspect_preserving_scaling,
27 params.has_overscan,
28 params.display_name,
29 std::vector<const DisplayMode*>(),
30 NULL,
31 NULL),
32 string_representation_(params.string_representation) {
33 for (size_t i = 0; i < params.modes.size(); ++i) {
34 modes_.push_back(new DisplayModeProxy(params.modes[i]));
36 if (params.has_current_mode &&
37 SameModes(params.modes[i], params.current_mode))
38 current_mode_ = modes_.back();
40 if (params.has_native_mode &&
41 SameModes(params.modes[i], params.native_mode))
42 native_mode_ = modes_.back();
46 DisplaySnapshotProxy::~DisplaySnapshotProxy() {
49 std::string DisplaySnapshotProxy::ToString() const {
50 return string_representation_;
53 } // namespace ui