OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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/fake_display_snapshot.h" |
| 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "base/strings/stringprintf.h" |
| 10 |
| 11 namespace display { |
| 12 |
| 13 namespace { |
| 14 |
| 15 // For a non high-DPI display (96 dpi) use a pitch of 265µm. |
| 16 static const float kDisplayPitchMM = 0.265; |
| 17 |
| 18 } // namespace |
| 19 |
| 20 FakeDisplaySnapshot::FakeDisplaySnapshot(int64_t display_id, |
| 21 const gfx::Size& display_size, |
| 22 ui::DisplayConnectionType type, |
| 23 std::string name) |
| 24 : DisplaySnapshot(display_id, |
| 25 gfx::Point(0, 0), |
| 26 gfx::Size(display_size.width() * kDisplayPitchMM, |
| 27 display_size.height() * kDisplayPitchMM), |
| 28 type, |
| 29 false, |
| 30 false, |
| 31 false, |
| 32 name, |
| 33 base::FilePath(), |
| 34 std::vector<std::unique_ptr<const ui::DisplayMode>>(), |
| 35 std::vector<uint8_t>(), |
| 36 nullptr, |
| 37 nullptr) { |
| 38 ui::DisplayMode mode(display_size, false, 60.0f); |
| 39 modes_.push_back(mode.Clone()); |
| 40 |
| 41 native_mode_ = modes_.front().get(); |
| 42 } |
| 43 |
| 44 FakeDisplaySnapshot::~FakeDisplaySnapshot() {} |
| 45 |
| 46 std::string FakeDisplaySnapshot::ToString() const { |
| 47 return base::StringPrintf( |
| 48 "id=%ld 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 display |
OLD | NEW |