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