| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 void Display::SetScaleAndBounds( | 72 void Display::SetScaleAndBounds( |
| 73 float device_scale_factor, | 73 float device_scale_factor, |
| 74 const gfx::Rect& bounds_in_pixel) { | 74 const gfx::Rect& bounds_in_pixel) { |
| 75 Insets insets = bounds_.InsetsFrom(work_area_); | 75 Insets insets = bounds_.InsetsFrom(work_area_); |
| 76 if (!HasForceDeviceScaleFactor()) | 76 if (!HasForceDeviceScaleFactor()) |
| 77 device_scale_factor_ = device_scale_factor; | 77 device_scale_factor_ = device_scale_factor; |
| 78 #if defined(USE_AURA) | 78 #if defined(USE_AURA) |
| 79 bounds_in_pixel_ = bounds_in_pixel; | 79 bounds_in_pixel_ = bounds_in_pixel; |
| 80 #endif | 80 #endif |
| 81 // TODO(oshima): For m19, work area/display bounds that chrome/webapps sees | |
| 82 // has (0, 0) origin because it's simpler and enough. Fix this when | |
| 83 // real multi display support is implemented. | |
| 84 bounds_ = gfx::Rect( | 81 bounds_ = gfx::Rect( |
| 85 bounds_in_pixel.size().Scale(1.0f / device_scale_factor_)); | 82 bounds_in_pixel.size().Scale(1.0f / device_scale_factor_)); |
| 86 UpdateWorkAreaFromInsets(insets); | 83 UpdateWorkAreaFromInsets(insets); |
| 87 } | 84 } |
| 88 | 85 |
| 89 void Display::SetSize(const gfx::Size& size_in_pixel) { | 86 void Display::SetSize(const gfx::Size& size_in_pixel) { |
| 90 SetScaleAndBounds( | 87 SetScaleAndBounds( |
| 91 device_scale_factor_, | 88 device_scale_factor_, |
| 92 #if defined(USE_AURA) | 89 #if defined(USE_AURA) |
| 93 gfx::Rect(bounds_in_pixel_.origin(), size_in_pixel)); | 90 gfx::Rect(bounds_in_pixel_.origin(), size_in_pixel)); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 107 | 104 |
| 108 std::string Display::ToString() const { | 105 std::string Display::ToString() const { |
| 109 return base::StringPrintf("Display[%d] bounds=%s, workarea=%s, scale=%f", | 106 return base::StringPrintf("Display[%d] bounds=%s, workarea=%s, scale=%f", |
| 110 id_, | 107 id_, |
| 111 bounds_.ToString().c_str(), | 108 bounds_.ToString().c_str(), |
| 112 work_area_.ToString().c_str(), | 109 work_area_.ToString().c_str(), |
| 113 device_scale_factor_); | 110 device_scale_factor_); |
| 114 } | 111 } |
| 115 | 112 |
| 116 } // namespace gfx | 113 } // namespace gfx |
| OLD | NEW |