Chromium Code Reviews| 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 : DisplaySnapshot(display_id, | |
| 24 gfx::Point(0, 0), | |
| 25 gfx::Size(display_size.width() * kDisplayPitchMM, | |
| 26 display_size.height() * kDisplayPitchMM), | |
| 27 type, | |
| 28 false, | |
| 29 false, | |
| 30 false, | |
| 31 "Fake Display", | |
|
rjkroege
2016/09/15 00:52:46
given that there could be more than one, can you g
kylechar
2016/09/15 17:31:55
Done.
| |
| 32 base::FilePath(), | |
| 33 std::vector<std::unique_ptr<const ui::DisplayMode>>(), | |
| 34 std::vector<uint8_t>(), | |
| 35 nullptr, | |
| 36 nullptr) { | |
| 37 ui::DisplayMode mode(display_size, false, 60.0f); | |
| 38 modes_.push_back(mode.Clone()); | |
| 39 | |
| 40 native_mode_ = modes_.front().get(); | |
| 41 } | |
| 42 | |
| 43 FakeDisplaySnapshot::~FakeDisplaySnapshot() {} | |
| 44 | |
| 45 std::string FakeDisplaySnapshot::ToString() const { | |
| 46 return base::StringPrintf( | |
| 47 "id=%ld current_mode=%s physical_size=%s", display_id_, | |
| 48 current_mode_ ? current_mode_->ToString().c_str() : "nullptr", | |
| 49 physical_size_.ToString().c_str()); | |
| 50 } | |
| 51 | |
| 52 } // namespace display | |
| OLD | NEW |