OLD | NEW |
(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 |
OLD | NEW |