| 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/common/wallpaper/wallpaper_view.h" | 5 #include "ash/common/wallpaper/wallpaper_view.h" |
| 6 | 6 |
| 7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
| 8 #include "ash/common/wallpaper/wallpaper_controller.h" | 8 #include "ash/common/wallpaper/wallpaper_controller.h" |
| 9 #include "ash/common/wallpaper/wallpaper_delegate.h" | 9 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 10 #include "ash/common/wallpaper/wallpaper_widget_controller.h" | 10 #include "ash/common/wallpaper/wallpaper_widget_controller.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 view->SetPaintToLayer(true); | 37 view->SetPaintToLayer(true); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Overrides views::View. | 40 // Overrides views::View. |
| 41 void Layout() override { | 41 void Layout() override { |
| 42 WmWindow* window = WmLookup::Get()->GetWindowForWidget(GetWidget()); | 42 WmWindow* window = WmLookup::Get()->GetWindowForWidget(GetWidget()); |
| 43 // Keep |this| at the bottom since there may be other windows on top of the | 43 // Keep |this| at the bottom since there may be other windows on top of the |
| 44 // wallpaper view such as an overview mode shield. | 44 // wallpaper view such as an overview mode shield. |
| 45 window->GetParent()->StackChildAtBottom(window); | 45 window->GetParent()->StackChildAtBottom(window); |
| 46 display::Display display = window->GetDisplayNearestWindow(); | 46 display::Display display = window->GetDisplayNearestWindow(); |
| 47 |
| 48 // TODO(mash): Mash returns a fake ManagedDisplayInfo. crbug.com/622480 |
| 49 float ui_scale = 1.f; |
| 47 display::ManagedDisplayInfo info = | 50 display::ManagedDisplayInfo info = |
| 48 WmShell::Get()->GetDisplayInfo(display.id()); | 51 WmShell::Get()->GetDisplayInfo(display.id()); |
| 49 float ui_scale = info.GetEffectiveUIScale(); | 52 if (info.id() == display.id()) |
| 53 ui_scale = info.GetEffectiveUIScale(); |
| 54 |
| 50 gfx::Size rounded_size = | 55 gfx::Size rounded_size = |
| 51 gfx::ScaleToFlooredSize(display.size(), 1.f / ui_scale); | 56 gfx::ScaleToFlooredSize(display.size(), 1.f / ui_scale); |
| 52 DCHECK_EQ(1, child_count()); | 57 DCHECK_EQ(1, child_count()); |
| 53 views::View* child = child_at(0); | 58 views::View* child = child_at(0); |
| 54 child->SetBounds(0, 0, rounded_size.width(), rounded_size.height()); | 59 child->SetBounds(0, 0, rounded_size.width(), rounded_size.height()); |
| 55 gfx::Transform transform; | 60 gfx::Transform transform; |
| 56 // Apply RTL transform explicitly becacuse Views layer code | 61 // Apply RTL transform explicitly becacuse Views layer code |
| 57 // doesn't handle RTL. crbug.com/458753. | 62 // doesn't handle RTL. crbug.com/458753. |
| 58 transform.Translate(-child->GetMirroredX(), 0); | 63 transform.Translate(-child->GetMirroredX(), 0); |
| 59 transform.Scale(ui_scale, ui_scale); | 64 transform.Scale(ui_scale, ui_scale); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // Disable animation if transition to login screen from an empty background. | 231 // Disable animation if transition to login screen from an empty background. |
| 227 wallpaper_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); | 232 wallpaper_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); |
| 228 } | 233 } |
| 229 | 234 |
| 230 WmWindow* container = root_window->GetChildByShellWindowId(container_id); | 235 WmWindow* container = root_window->GetChildByShellWindowId(container_id); |
| 231 wallpaper_widget->SetBounds(container->GetBounds()); | 236 wallpaper_widget->SetBounds(container->GetBounds()); |
| 232 return wallpaper_widget; | 237 return wallpaper_widget; |
| 233 } | 238 } |
| 234 | 239 |
| 235 } // namespace ash | 240 } // namespace ash |
| OLD | NEW |