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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/monitor.h ('k') | ui/gfx/monitor_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/gfx/monitor.h"
6
7 #include "ui/gfx/insets.h"
8
9 namespace gfx {
10
11 Monitor::Monitor() : id_(-1), device_scale_factor_(1.0) {
12 }
13
14 Monitor::Monitor(int id) : id_(id), device_scale_factor_(1.0) {
15 }
16
17 Monitor::Monitor(int id, const gfx::Rect& bounds)
18 : id_(id),
19 bounds_(bounds),
20 work_area_(bounds),
21 device_scale_factor_(1.0) {
22 }
23
24 Monitor::~Monitor() {
25 }
26
27 void Monitor::SetBoundsAndUpdateWorkArea(const gfx::Rect& bounds) {
28 Insets insets(work_area_.y() - bounds_.y(),
29 work_area_.x() - bounds_.x(),
30 bounds_.bottom() - work_area_.bottom(),
31 bounds_.right() - work_area_.right());
32 bounds_ = bounds;
33 UpdateWorkAreaWithInsets(insets);
34 }
35
36 void Monitor::SetSizeAndUpdateWorkArea(const gfx::Size& size) {
37 SetBoundsAndUpdateWorkArea(gfx::Rect(bounds_.origin(), size));
38 }
39
40 void Monitor::UpdateWorkAreaWithInsets(const gfx::Insets& insets) {
41 work_area_ = bounds_;
42 work_area_.Inset(insets);
43 }
44
45 } // namespace gfx
OLDNEW
« 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