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