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 "ash/desktop_background/desktop_background_view.h" | 5 #include "ash/desktop_background/desktop_background_view.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 view->SetPaintToLayer(true); | 50 view->SetPaintToLayer(true); |
51 } | 51 } |
52 | 52 |
53 // Overrides views::View. | 53 // Overrides views::View. |
54 void Layout() override { | 54 void Layout() override { |
55 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( | 55 gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( |
56 GetWidget()->GetNativeView()); | 56 GetWidget()->GetNativeView()); |
57 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 57 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
58 DisplayInfo info = display_manager->GetDisplayInfo(display.id()); | 58 DisplayInfo info = display_manager->GetDisplayInfo(display.id()); |
59 float ui_scale = info.GetEffectiveUIScale(); | 59 float ui_scale = info.GetEffectiveUIScale(); |
60 gfx::SizeF pixel_size = display.size(); | 60 gfx::Size rounded_size = |
61 pixel_size.Scale(1.0f / ui_scale); | 61 gfx::ScaleToFlooredSize(display.size(), 1.f / ui_scale); |
62 gfx::Size rounded_size = gfx::ToFlooredSize(pixel_size); | |
63 DCHECK_EQ(1, child_count()); | 62 DCHECK_EQ(1, child_count()); |
64 views::View* child = child_at(0); | 63 views::View* child = child_at(0); |
65 child->SetBounds(0, 0, rounded_size.width(), rounded_size.height()); | 64 child->SetBounds(0, 0, rounded_size.width(), rounded_size.height()); |
66 gfx::Transform transform; | 65 gfx::Transform transform; |
67 // Apply RTL transform explicitly becacuse Views layer code | 66 // Apply RTL transform explicitly becacuse Views layer code |
68 // doesn't handle RTL. crbug.com/458753. | 67 // doesn't handle RTL. crbug.com/458753. |
69 transform.Translate(-child->GetMirroredX(), 0); | 68 transform.Translate(-child->GetMirroredX(), 0); |
70 transform.Scale(ui_scale, ui_scale); | 69 transform.Scale(ui_scale, ui_scale); |
71 child->SetTransform(transform); | 70 child->SetTransform(transform); |
72 } | 71 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // Disable animation if transition to login screen from an empty background. | 246 // Disable animation if transition to login screen from an empty background. |
248 wm::SetWindowVisibilityAnimationTransition( | 247 wm::SetWindowVisibilityAnimationTransition( |
249 desktop_widget->GetNativeView(), wm::ANIMATE_NONE); | 248 desktop_widget->GetNativeView(), wm::ANIMATE_NONE); |
250 } | 249 } |
251 | 250 |
252 desktop_widget->SetBounds(params.parent->bounds()); | 251 desktop_widget->SetBounds(params.parent->bounds()); |
253 return desktop_widget; | 252 return desktop_widget; |
254 } | 253 } |
255 | 254 |
256 } // namespace ash | 255 } // namespace ash |
OLD | NEW |