| OLD | NEW |
| (Empty) |
| 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/display/chromeos/display_snapshot_virtual.h" | |
| 6 | |
| 7 #include <inttypes.h> | |
| 8 | |
| 9 #include "base/strings/stringprintf.h" | |
| 10 #include "ui/display/types/display_mode.h" | |
| 11 | |
| 12 namespace ui { | |
| 13 | |
| 14 namespace { | |
| 15 | |
| 16 // For a non hi-DPI display (96 dpi) use a pitch of 265µm. | |
| 17 static const float kVirtualDisplayPitchMM = 0.265; | |
| 18 | |
| 19 } // namespace | |
| 20 | |
| 21 DisplaySnapshotVirtual::DisplaySnapshotVirtual(int64_t display_id, | |
| 22 const gfx::Size& display_size) | |
| 23 : DisplaySnapshot(display_id, | |
| 24 gfx::Point(0, 0), | |
| 25 // Calculate physical size assuming 96dpi display. | |
| 26 gfx::Size(display_size.width() * kVirtualDisplayPitchMM, | |
| 27 display_size.height() * kVirtualDisplayPitchMM), | |
| 28 DISPLAY_CONNECTION_TYPE_VIRTUAL, | |
| 29 false, | |
| 30 false, | |
| 31 false, | |
| 32 "Virtual display", | |
| 33 base::FilePath(), | |
| 34 std::vector<std::unique_ptr<const DisplayMode>>(), | |
| 35 std::vector<uint8_t>(), // Virtual displays have no EDID. | |
| 36 nullptr, | |
| 37 nullptr) { | |
| 38 mode_.reset(new DisplayMode(display_size, false, 30)); | |
| 39 modes_.push_back(mode_->Clone()); | |
| 40 | |
| 41 native_mode_ = modes_.front().get(); | |
| 42 } | |
| 43 | |
| 44 DisplaySnapshotVirtual::~DisplaySnapshotVirtual() {} | |
| 45 | |
| 46 std::string DisplaySnapshotVirtual::ToString() const { | |
| 47 return base::StringPrintf( | |
| 48 "Virtual id=%" PRId64 " current_mode=%s physical_size=%s", display_id_, | |
| 49 current_mode_ ? current_mode_->ToString().c_str() : "nullptr", | |
| 50 physical_size_.ToString().c_str()); | |
| 51 } | |
| 52 | |
| 53 } // namespace ui | |
| OLD | NEW |