| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 gfx::Size cropped_size; | 120 gfx::Size cropped_size; |
| 121 if (vertical_ratio > horizontal_ratio) { | 121 if (vertical_ratio > horizontal_ratio) { |
| 122 cropped_size = gfx::Size( | 122 cropped_size = gfx::Size( |
| 123 RoundPositive(static_cast<double>(width()) / vertical_ratio), | 123 RoundPositive(static_cast<double>(width()) / vertical_ratio), |
| 124 wallpaper.height()); | 124 wallpaper.height()); |
| 125 } else { | 125 } else { |
| 126 cropped_size = gfx::Size(wallpaper.width(), | 126 cropped_size = gfx::Size(wallpaper.width(), |
| 127 RoundPositive(static_cast<double>(height()) / horizontal_ratio)); | 127 RoundPositive(static_cast<double>(height()) / horizontal_ratio)); |
| 128 } | 128 } |
| 129 | 129 |
| 130 gfx::Rect wallpaper_cropped_rect = wallpaper_rect.Center(cropped_size); | 130 gfx::Rect wallpaper_cropped_rect = wallpaper_rect; |
| 131 wallpaper_cropped_rect.ClampToCenteredSize(cropped_size); |
| 131 canvas->DrawImageInt(wallpaper, | 132 canvas->DrawImageInt(wallpaper, |
| 132 wallpaper_cropped_rect.x(), wallpaper_cropped_rect.y(), | 133 wallpaper_cropped_rect.x(), wallpaper_cropped_rect.y(), |
| 133 wallpaper_cropped_rect.width(), wallpaper_cropped_rect.height(), | 134 wallpaper_cropped_rect.width(), wallpaper_cropped_rect.height(), |
| 134 0, 0, width(), height(), | 135 0, 0, width(), height(), |
| 135 true); | 136 true); |
| 136 } else if (wallpaper_layout == ash::TILE) { | 137 } else if (wallpaper_layout == ash::TILE) { |
| 137 canvas->TileImageInt(wallpaper, 0, 0, width(), height()); | 138 canvas->TileImageInt(wallpaper, 0, 0, width(), height()); |
| 138 } else if (wallpaper_layout == ash::STRETCH) { | 139 } else if (wallpaper_layout == ash::STRETCH) { |
| 139 // This is generally not recommended as it may show artifacts. | 140 // This is generally not recommended as it may show artifacts. |
| 140 canvas->DrawImageInt(wallpaper, 0, 0, wallpaper.width(), | 141 canvas->DrawImageInt(wallpaper, 0, 0, wallpaper.width(), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); | 189 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); |
| 189 settings.AddObserver(new ShowWallpaperAnimationObserver(root_window, | 190 settings.AddObserver(new ShowWallpaperAnimationObserver(root_window, |
| 190 desktop_widget)); | 191 desktop_widget)); |
| 191 desktop_widget->Show(); | 192 desktop_widget->Show(); |
| 192 desktop_widget->GetNativeView()->SetName("DesktopBackgroundView"); | 193 desktop_widget->GetNativeView()->SetName("DesktopBackgroundView"); |
| 193 return desktop_widget; | 194 return desktop_widget; |
| 194 } | 195 } |
| 195 | 196 |
| 196 } // namespace internal | 197 } // namespace internal |
| 197 } // namespace ash | 198 } // namespace ash |
| OLD | NEW |