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

Unified Diff: ui/gfx/monitor.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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/gfx/monitor.h ('k') | ui/gfx/monitor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/monitor.cc
diff --git a/ui/gfx/monitor.cc b/ui/gfx/monitor.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8e56e0fdf7f052bcf863d2ac0ea817116b6c6838
--- /dev/null
+++ b/ui/gfx/monitor.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 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/gfx/monitor.h"
+
+#include "ui/gfx/insets.h"
+
+namespace gfx {
+
+Monitor::Monitor() : id_(-1), device_scale_factor_(1.0) {
+}
+
+Monitor::Monitor(int id) : id_(id), device_scale_factor_(1.0) {
+}
+
+Monitor::Monitor(int id, const gfx::Rect& bounds)
+ : id_(id),
+ bounds_(bounds),
+ work_area_(bounds),
+ device_scale_factor_(1.0) {
+}
+
+Monitor::~Monitor() {
+}
+
+void Monitor::SetBoundsAndUpdateWorkArea(const gfx::Rect& bounds) {
+ Insets insets(work_area_.y() - bounds_.y(),
+ work_area_.x() - bounds_.x(),
+ bounds_.bottom() - work_area_.bottom(),
+ bounds_.right() - work_area_.right());
+ bounds_ = bounds;
+ UpdateWorkAreaWithInsets(insets);
+}
+
+void Monitor::SetSizeAndUpdateWorkArea(const gfx::Size& size) {
+ SetBoundsAndUpdateWorkArea(gfx::Rect(bounds_.origin(), size));
+}
+
+void Monitor::UpdateWorkAreaWithInsets(const gfx::Insets& insets) {
+ work_area_ = bounds_;
+ work_area_.Inset(insets);
+}
+
+} // namespace gfx
« no previous file with comments | « ui/gfx/monitor.h ('k') | ui/gfx/monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698