| 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_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 protected: | 89 protected: |
| 90 // A color that can be passed to CreateImage(). Specifically chosen to not | 90 // A color that can be passed to CreateImage(). Specifically chosen to not |
| 91 // conflict with any of the default wallpaper colors. | 91 // conflict with any of the default wallpaper colors. |
| 92 static const SkColor kCustomWallpaperColor = SK_ColorMAGENTA; | 92 static const SkColor kCustomWallpaperColor = SK_ColorMAGENTA; |
| 93 | 93 |
| 94 // Creates an image of size |size|. | 94 // Creates an image of size |size|. |
| 95 gfx::ImageSkia CreateImage(int width, int height, SkColor color) { | 95 gfx::ImageSkia CreateImage(int width, int height, SkColor color) { |
| 96 SkBitmap bitmap; | 96 SkBitmap bitmap; |
| 97 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 97 bitmap.allocN32Pixels(width, height); |
| 98 bitmap.allocPixels(); | |
| 99 bitmap.eraseColor(color); | 98 bitmap.eraseColor(color); |
| 100 gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 99 gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
| 101 return image; | 100 return image; |
| 102 } | 101 } |
| 103 | 102 |
| 104 // Runs kAnimatingDesktopController's animation to completion. | 103 // Runs kAnimatingDesktopController's animation to completion. |
| 105 // TODO(bshe): Don't require tests to run animations; it's slow. | 104 // TODO(bshe): Don't require tests to run animations; it's slow. |
| 106 void RunDesktopControllerAnimation() { | 105 void RunDesktopControllerAnimation() { |
| 107 DesktopBackgroundWidgetController* controller = | 106 DesktopBackgroundWidgetController* controller = |
| 108 Shell::GetPrimaryRootWindowController() | 107 Shell::GetPrimaryRootWindowController() |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 341 |
| 343 // Maximum width and height belongs to different displays. | 342 // Maximum width and height belongs to different displays. |
| 344 UpdateDisplay("400x300,100x500"); | 343 UpdateDisplay("400x300,100x500"); |
| 345 EXPECT_EQ( | 344 EXPECT_EQ( |
| 346 "400x500", | 345 "400x500", |
| 347 DesktopBackgroundController::GetMaxDisplaySizeInNative().ToString()); | 346 DesktopBackgroundController::GetMaxDisplaySizeInNative().ToString()); |
| 348 } | 347 } |
| 349 | 348 |
| 350 | 349 |
| 351 } // namespace ash | 350 } // namespace ash |
| OLD | NEW |