OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u
tils.h" | 5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager_test_u
tils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 const int kWallpaperSize = 2; | 80 const int kWallpaperSize = 2; |
81 | 81 |
82 bool CreateJPEGImage(int width, | 82 bool CreateJPEGImage(int width, |
83 int height, | 83 int height, |
84 SkColor color, | 84 SkColor color, |
85 std::vector<unsigned char>* output) { | 85 std::vector<unsigned char>* output) { |
86 SkBitmap bitmap; | 86 SkBitmap bitmap; |
87 bitmap.allocN32Pixels(width, height); | 87 bitmap.allocN32Pixels(width, height); |
88 bitmap.eraseColor(color); | 88 bitmap.eraseColor(color); |
89 | 89 |
90 const int kQuality = 80; | 90 constexpr int kQuality = 80; |
91 if (!gfx::JPEGCodec::Encode( | 91 if (!gfx::JPEGCodec::Encode(bitmap, kQuality, output)) { |
92 static_cast<const unsigned char*>(bitmap.getPixels()), | |
93 gfx::JPEGCodec::FORMAT_SkBitmap, | |
94 width, | |
95 height, | |
96 bitmap.rowBytes(), | |
97 kQuality, | |
98 output)) { | |
99 LOG(ERROR) << "Unable to encode " << width << "x" << height << " bitmap"; | 92 LOG(ERROR) << "Unable to encode " << width << "x" << height << " bitmap"; |
100 return false; | 93 return false; |
101 } | 94 } |
102 return true; | 95 return true; |
103 } | 96 } |
104 | 97 |
105 gfx::ImageSkia CreateTestImage(int width, int height, SkColor color) { | 98 gfx::ImageSkia CreateTestImage(int width, int height, SkColor color) { |
106 SkBitmap bitmap; | 99 SkBitmap bitmap; |
107 bitmap.allocN32Pixels(width, height); | 100 bitmap.allocN32Pixels(width, height); |
108 bitmap.eraseColor(color); | 101 bitmap.eraseColor(color); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 kWallpaperSize, | 218 kWallpaperSize, |
226 kLargeChildWallpaperColor)); | 219 kLargeChildWallpaperColor)); |
227 | 220 |
228 command_line->reset(new base::CommandLine(options)); | 221 command_line->reset(new base::CommandLine(options)); |
229 WallpaperManager::Get()->SetCommandLineForTesting(command_line->get()); | 222 WallpaperManager::Get()->SetCommandLineForTesting(command_line->get()); |
230 } | 223 } |
231 | 224 |
232 } // namespace wallpaper_manager_test_utils | 225 } // namespace wallpaper_manager_test_utils |
233 | 226 |
234 } // namespace chromeos | 227 } // namespace chromeos |
OLD | NEW |