| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/accelerators/debug_commands.h" | 5 #include "ash/common/accelerators/debug_commands.h" |
| 6 | 6 |
| 7 #include "ash/common/accelerators/accelerator_commands.h" | 7 #include "ash/common/accelerators/accelerator_commands.h" |
| 8 #include "ash/common/ash_switches.h" | 8 #include "ash/common/ash_switches.h" |
| 9 #include "ash/common/shell_delegate.h" | 9 #include "ash/common/shell_delegate.h" |
| 10 #include "ash/common/system/toast/toast_data.h" | 10 #include "ash/common/system/toast/toast_data.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 LOG(ERROR) << out.str(); | 86 LOG(ERROR) << out.str(); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 gfx::ImageSkia CreateWallpaperImage(SkColor fill, SkColor rect) { | 90 gfx::ImageSkia CreateWallpaperImage(SkColor fill, SkColor rect) { |
| 91 // TODO(oshima): Consider adding a command line option to control wallpaper | 91 // TODO(oshima): Consider adding a command line option to control wallpaper |
| 92 // images for testing. The size is randomly picked. | 92 // images for testing. The size is randomly picked. |
| 93 gfx::Size image_size(1366, 768); | 93 gfx::Size image_size(1366, 768); |
| 94 SkBitmap bitmap; | 94 SkBitmap bitmap; |
| 95 bitmap.allocN32Pixels(image_size.width(), image_size.height(), true); | 95 bitmap.allocN32Pixels(image_size.width(), image_size.height(), true); |
| 96 sk_sp<SkSurface> surface = SkSurface::MakeRasterDirect( | 96 SkCanvas canvas(bitmap); |
| 97 bitmap.info(), bitmap.getPixels(), bitmap.rowBytes()); | 97 canvas.drawColor(fill); |
| 98 surface->getCanvas()->drawColor(fill); | |
| 99 SkPaint paint; | 98 SkPaint paint; |
| 100 paint.setColor(rect); | 99 paint.setColor(rect); |
| 101 paint.setStrokeWidth(10); | 100 paint.setStrokeWidth(10); |
| 102 paint.setStyle(SkPaint::kStroke_Style); | 101 paint.setStyle(SkPaint::kStroke_Style); |
| 103 paint.setBlendMode(SkBlendMode::kSrcOver); | 102 paint.setBlendMode(SkBlendMode::kSrcOver); |
| 104 surface->getCanvas()->drawRoundRect(gfx::RectToSkRect(gfx::Rect(image_size)), | 103 canvas.drawRoundRect(gfx::RectToSkRect(gfx::Rect(image_size)), 100.f, 100.f, |
| 105 100.f, 100.f, paint); | 104 paint); |
| 106 return gfx::ImageSkia(gfx::ImageSkiaRep(std::move(bitmap), 1.f)); | 105 return gfx::ImageSkia(gfx::ImageSkiaRep(std::move(bitmap), 1.f)); |
| 107 } | 106 } |
| 108 | 107 |
| 109 void HandleToggleWallpaperMode() { | 108 void HandleToggleWallpaperMode() { |
| 110 static int index = 0; | 109 static int index = 0; |
| 111 WallpaperController* wallpaper_controller = | 110 WallpaperController* wallpaper_controller = |
| 112 Shell::GetInstance()->wallpaper_controller(); | 111 Shell::GetInstance()->wallpaper_controller(); |
| 113 switch (++index % 4) { | 112 switch (++index % 4) { |
| 114 case 0: | 113 case 0: |
| 115 Shell::Get()->wallpaper_delegate()->InitializeWallpaper(); | 114 Shell::Get()->wallpaper_delegate()->InitializeWallpaper(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 case DEBUG_TRIGGER_CRASH: | 210 case DEBUG_TRIGGER_CRASH: |
| 212 HandleTriggerCrash(); | 211 HandleTriggerCrash(); |
| 213 break; | 212 break; |
| 214 default: | 213 default: |
| 215 break; | 214 break; |
| 216 } | 215 } |
| 217 } | 216 } |
| 218 | 217 |
| 219 } // namespace debug | 218 } // namespace debug |
| 220 } // namespace ash | 219 } // namespace ash |
| OLD | NEW |