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

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: cleanup 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
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() : device_scale_factor_(1.0) {
12 }
13
14 Monitor::Monitor(const gfx::Rect& bounds)
15 : bounds_(bounds), work_area_(bounds), device_scale_factor_(1.0) {
16 }
17
18 Monitor::~Monitor() {
19 }
20
21 void Monitor::SetBoundsAndUpdateWorkArea(const gfx::Rect& bounds) {
22 Insets insets(work_area_.y() - bounds_.y(),
23 work_area_.x() - bounds_.x(),
24 bounds_.bottom() - work_area_.bottom(),
25 bounds_.right() - work_area_.right());
26 bounds_ = bounds;
27 UpdateWorkAreaWithInsets(insets);
28 }
29
30 void Monitor::SetSizeAndUpdateWorkArea(const gfx::Size& size) {
31 SetBoundsAndUpdateWorkArea(gfx::Rect(bounds_.origin(), size));
32 }
33
34 void Monitor::UpdateWorkAreaWithInsets(const gfx::Insets& insets) {
35 work_area_ = bounds_;
36 work_area_.Inset(insets);
37 }
38
39 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698