OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gfx/display.h" | 5 #include "ui/gfx/display.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 #else | 101 #else |
102 gfx::Rect(bounds_.origin(), size_in_pixel)); | 102 gfx::Rect(bounds_.origin(), size_in_pixel)); |
103 #endif | 103 #endif |
104 } | 104 } |
105 | 105 |
106 void Display::UpdateWorkAreaFromInsets(const gfx::Insets& insets) { | 106 void Display::UpdateWorkAreaFromInsets(const gfx::Insets& insets) { |
107 work_area_ = bounds_; | 107 work_area_ = bounds_; |
108 work_area_.Inset(insets); | 108 work_area_.Inset(insets); |
109 } | 109 } |
110 | 110 |
111 void Display::SetOverscanInsets(const gfx::Insets& insets) { | |
112 Rect bounds_in_pixel(bounds_in_pixel_); | |
113 bounds_in_pixel.Inset(overscan_insets_.Scale(device_scale_factor_).Scale(-1)); | |
114 bounds_in_pixel.Inset(insets.Scale(device_scale_factor_)); | |
115 SetScaleAndBounds(device_scale_factor_, bounds_in_pixel); | |
oshima
2012/10/16 22:46:26
this updates bounds_in_pixel, so it will keep shri
| |
116 overscan_insets_ = insets; | |
117 } | |
118 | |
111 gfx::Size Display::GetSizeInPixel() const { | 119 gfx::Size Display::GetSizeInPixel() const { |
112 return gfx::ToFlooredSize(size().Scale(device_scale_factor_)); | 120 return gfx::ToFlooredSize(size().Scale(device_scale_factor_)); |
113 } | 121 } |
114 | 122 |
115 std::string Display::ToString() const { | 123 std::string Display::ToString() const { |
116 return base::StringPrintf("Display[%lld] bounds=%s, workarea=%s, scale=%f", | 124 return base::StringPrintf("Display[%lld] bounds=%s, workarea=%s, scale=%f", |
117 static_cast<long long int>(id_), | 125 static_cast<long long int>(id_), |
118 bounds_.ToString().c_str(), | 126 bounds_.ToString().c_str(), |
119 work_area_.ToString().c_str(), | 127 work_area_.ToString().c_str(), |
120 device_scale_factor_); | 128 device_scale_factor_); |
121 } | 129 } |
122 | 130 |
123 } // namespace gfx | 131 } // namespace gfx |
OLD | NEW |