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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 gfx::ToFlooredSize(gfx::ScaleSize(bounds_in_pixel.size(), | 146 gfx::ToFlooredSize(gfx::ScaleSize(bounds_in_pixel.size(), |
147 1.0f / device_scale_factor_))); | 147 1.0f / device_scale_factor_))); |
148 UpdateWorkAreaFromInsets(insets); | 148 UpdateWorkAreaFromInsets(insets); |
149 } | 149 } |
150 | 150 |
151 void Display::SetSize(const gfx::Size& size_in_pixel) { | 151 void Display::SetSize(const gfx::Size& size_in_pixel) { |
152 gfx::Point origin = bounds_.origin(); | 152 gfx::Point origin = bounds_.origin(); |
153 #if defined(USE_AURA) | 153 #if defined(USE_AURA) |
154 gfx::PointF origin_f = origin; | 154 gfx::PointF origin_f = origin; |
155 origin_f.Scale(device_scale_factor_); | 155 origin_f.Scale(device_scale_factor_); |
156 origin.SetPoint(origin_f.x(), origin_f.y()); | 156 origin = gfx::ToFlooredPoint(origin_f); |
157 #endif | 157 #endif |
158 SetScaleAndBounds(device_scale_factor_, gfx::Rect(origin, size_in_pixel)); | 158 SetScaleAndBounds(device_scale_factor_, gfx::Rect(origin, size_in_pixel)); |
159 } | 159 } |
160 | 160 |
161 void Display::UpdateWorkAreaFromInsets(const gfx::Insets& insets) { | 161 void Display::UpdateWorkAreaFromInsets(const gfx::Insets& insets) { |
162 work_area_ = bounds_; | 162 work_area_ = bounds_; |
163 work_area_.Inset(insets); | 163 work_area_.Inset(insets); |
164 } | 164 } |
165 | 165 |
166 gfx::Size Display::GetSizeInPixel() const { | 166 gfx::Size Display::GetSizeInPixel() const { |
(...skipping 16 matching lines...) Expand all Loading... |
183 | 183 |
184 int64 Display::InternalDisplayId() { | 184 int64 Display::InternalDisplayId() { |
185 return internal_display_id_; | 185 return internal_display_id_; |
186 } | 186 } |
187 | 187 |
188 void Display::SetInternalDisplayId(int64 internal_display_id) { | 188 void Display::SetInternalDisplayId(int64 internal_display_id) { |
189 internal_display_id_ = internal_display_id; | 189 internal_display_id_ = internal_display_id; |
190 } | 190 } |
191 | 191 |
192 } // namespace gfx | 192 } // namespace gfx |
OLD | NEW |