| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/display/screen.h" | 5 #include "ui/display/screen.h" |
| 6 | 6 |
| 7 #include "ui/display/display.h" | 7 #include "ui/display/display.h" |
| 8 #include "ui/gfx/geometry/rect.h" | 8 #include "ui/gfx/geometry/rect.h" |
| 9 | 9 |
| 10 namespace display { | 10 namespace display { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 float scale = GetDisplayNearestWindow(view).device_scale_factor(); | 39 float scale = GetDisplayNearestWindow(view).device_scale_factor(); |
| 40 return ScaleToEnclosingRect(screen_rect, 1.0f / scale); | 40 return ScaleToEnclosingRect(screen_rect, 1.0f / scale); |
| 41 } | 41 } |
| 42 | 42 |
| 43 gfx::Rect Screen::DIPToScreenRectInWindow(gfx::NativeView view, | 43 gfx::Rect Screen::DIPToScreenRectInWindow(gfx::NativeView view, |
| 44 const gfx::Rect& dip_rect) const { | 44 const gfx::Rect& dip_rect) const { |
| 45 float scale = GetDisplayNearestWindow(view).device_scale_factor(); | 45 float scale = GetDisplayNearestWindow(view).device_scale_factor(); |
| 46 return ScaleToEnclosingRect(dip_rect, scale); | 46 return ScaleToEnclosingRect(dip_rect, scale); |
| 47 } | 47 } |
| 48 | 48 |
| 49 float Screen::GetScaleFactorForWindow(gfx::NativeView view) const { |
| 50 const display::Display& nearest_display = GetDisplayNearestWindow(view); |
| 51 DCHECK(nearest_display.is_valid()); |
| 52 return nearest_display.device_scale_factor(); |
| 53 } |
| 54 |
| 49 } // namespace display | 55 } // namespace display |
| OLD | NEW |