OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "ui/display/types/display_snapshot.h" | 5 #include "ui/display/types/display_snapshot.h" |
6 | 6 |
7 namespace ui { | 7 namespace ui { |
8 | 8 |
9 namespace { | |
10 | |
11 // The display serial number beginning byte position and its length in the | |
12 // EDID number as defined in the spec. | |
13 // https://en.wikipedia.org/wiki/Extended_Display_Identification_Data | |
14 const size_t kSerialNumberBeginingByte = 12U; | |
15 const size_t kSerialNumberLengthInBytes = 4U; | |
16 | |
17 } // namespace | |
18 | |
19 DisplaySnapshot::DisplaySnapshot(int64_t display_id, | 9 DisplaySnapshot::DisplaySnapshot(int64_t display_id, |
20 const gfx::Point& origin, | 10 const gfx::Point& origin, |
21 const gfx::Size& physical_size, | 11 const gfx::Size& physical_size, |
22 DisplayConnectionType type, | 12 DisplayConnectionType type, |
23 bool is_aspect_preserving_scaling, | 13 bool is_aspect_preserving_scaling, |
24 bool has_overscan, | 14 bool has_overscan, |
25 std::string display_name, | 15 std::string display_name, |
26 const base::FilePath& sys_path, | 16 const base::FilePath& sys_path, |
27 const std::vector<const DisplayMode*>& modes, | 17 const std::vector<const DisplayMode*>& modes, |
28 const std::vector<uint8_t>& edid, | |
29 const DisplayMode* current_mode, | 18 const DisplayMode* current_mode, |
30 const DisplayMode* native_mode) | 19 const DisplayMode* native_mode) |
31 : display_id_(display_id), | 20 : display_id_(display_id), |
32 origin_(origin), | 21 origin_(origin), |
33 physical_size_(physical_size), | 22 physical_size_(physical_size), |
34 type_(type), | 23 type_(type), |
35 is_aspect_preserving_scaling_(is_aspect_preserving_scaling), | 24 is_aspect_preserving_scaling_(is_aspect_preserving_scaling), |
36 has_overscan_(has_overscan), | 25 has_overscan_(has_overscan), |
37 display_name_(display_name), | 26 display_name_(display_name), |
38 sys_path_(sys_path), | 27 sys_path_(sys_path), |
39 modes_(modes), | 28 modes_(modes), |
40 edid_(edid), | |
41 current_mode_(current_mode), | 29 current_mode_(current_mode), |
42 native_mode_(native_mode), | 30 native_mode_(native_mode), |
43 product_id_(kInvalidProductID) { | 31 product_id_(kInvalidProductID) {} |
44 // We must explicitly clear out the bytes that represent the serial number. | |
45 const size_t end = | |
46 std::min(kSerialNumberBeginingByte + kSerialNumberLengthInBytes, | |
47 edid_.size()); | |
48 for (size_t i = kSerialNumberBeginingByte; i < end; ++i) | |
49 edid_[i] = 0; | |
50 } | |
51 | 32 |
52 DisplaySnapshot::~DisplaySnapshot() {} | 33 DisplaySnapshot::~DisplaySnapshot() {} |
53 | 34 |
54 } // namespace ui | 35 } // namespace ui |
OLD | NEW |