Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: ui/display/fake_display_snapshot.cc

Issue 2324163002: Add FakeDisplayDelegate for off device usage. (Closed)
Patch Set: Fix windows compile problems. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/display/fake_display_snapshot.h ('k') | ui/display/types/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/fake_display_snapshot.cc
diff --git a/ui/display/fake_display_snapshot.cc b/ui/display/fake_display_snapshot.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4d2fbf5aeaac3e539ce874767c0d3625475dee2b
--- /dev/null
+++ b/ui/display/fake_display_snapshot.cc
@@ -0,0 +1,55 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/display/fake_display_snapshot.h"
+
+#include <inttypes.h>
+
+#include <vector>
+
+#include "base/strings/stringprintf.h"
+
+namespace display {
+
+namespace {
+
+// For a non high-DPI display (96 dpi) use a pitch of 265µm.
+static const float kDisplayPitchMM = 0.265f;
+
+} // namespace
+
+FakeDisplaySnapshot::FakeDisplaySnapshot(int64_t display_id,
+ const gfx::Size& display_size,
+ ui::DisplayConnectionType type,
+ std::string name)
+ : DisplaySnapshot(display_id,
+ gfx::Point(0, 0),
+ gfx::Size(display_size.width() * kDisplayPitchMM,
+ display_size.height() * kDisplayPitchMM),
+ type,
+ false,
+ false,
+ false,
+ name,
+ base::FilePath(),
+ std::vector<std::unique_ptr<const ui::DisplayMode>>(),
+ std::vector<uint8_t>(),
+ nullptr,
+ nullptr) {
+ ui::DisplayMode mode(display_size, false, 60.0f);
+ modes_.push_back(mode.Clone());
+
+ native_mode_ = modes_.front().get();
+}
+
+FakeDisplaySnapshot::~FakeDisplaySnapshot() {}
+
+std::string FakeDisplaySnapshot::ToString() const {
+ return base::StringPrintf(
+ "id=%" PRId64 " current_mode=%s physical_size=%s", display_id_,
+ current_mode_ ? current_mode_->ToString().c_str() : "nullptr",
+ physical_size_.ToString().c_str());
+}
+
+} // namespace display
« no previous file with comments | « ui/display/fake_display_snapshot.h ('k') | ui/display/types/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698