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

Side by Side Diff: ui/display/chromeos/display_snapshot_virtual.cc

Issue 1456623002: Add support for virtual displays (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Integrate latest review feedback Created 5 years 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 unified diff | Download patch
OLDNEW
(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 "Virtual display",
32 std::vector<const DisplayMode*>(),
33 nullptr,
34 nullptr) {
35 mode_.reset(new DisplayMode(display_size, false, 30));
36 modes_.push_back(mode_.get());
37
38 native_mode_ = modes_.front();
39 }
40
41 DisplaySnapshotVirtual::~DisplaySnapshotVirtual() {}
42
43 std::string DisplaySnapshotVirtual::ToString() const {
44 return base::StringPrintf(
45 "Virtual id=%" PRId64 " current_mode=%s physical_size=%s", display_id_,
46 current_mode_ ? current_mode_->ToString().c_str() : "nullptr",
47 physical_size_.ToString().c_str());
48 }
49
50 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698