Chromium Code Reviews| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 const int kQuality = 80; |
| 91 if (!gfx::JPEGCodec::Encode( | 91 if (!gfx::JPEGCodec::Encode( |
| 92 static_cast<const unsigned char*>(bitmap.getPixels()), | 92 static_cast<const unsigned char*>(bitmap.getPixels()), |
| 93 gfx::JPEGCodec::FORMAT_SkBitmap, | 93 kN32_SkColorType, width, height, bitmap.rowBytes(), kQuality, |
|
scroggo_chromium
2017/05/30 14:27:52
This parameter list makes me think we should've ta
dcheng
2017/06/02 15:35:00
I agree this would make sense: PNG codec has some
msarett1
2017/06/07 18:01:14
Yeah I think it should take an SkPixmap. SkBitmap
| |
| 94 width, | |
| 95 height, | |
| 96 bitmap.rowBytes(), | |
| 97 kQuality, | |
| 98 output)) { | 94 output)) { |
| 99 LOG(ERROR) << "Unable to encode " << width << "x" << height << " bitmap"; | 95 LOG(ERROR) << "Unable to encode " << width << "x" << height << " bitmap"; |
| 100 return false; | 96 return false; |
| 101 } | 97 } |
| 102 return true; | 98 return true; |
| 103 } | 99 } |
| 104 | 100 |
| 105 gfx::ImageSkia CreateTestImage(int width, int height, SkColor color) { | 101 gfx::ImageSkia CreateTestImage(int width, int height, SkColor color) { |
| 106 SkBitmap bitmap; | 102 SkBitmap bitmap; |
| 107 bitmap.allocN32Pixels(width, height); | 103 bitmap.allocN32Pixels(width, height); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 kWallpaperSize, | 221 kWallpaperSize, |
| 226 kLargeChildWallpaperColor)); | 222 kLargeChildWallpaperColor)); |
| 227 | 223 |
| 228 command_line->reset(new base::CommandLine(options)); | 224 command_line->reset(new base::CommandLine(options)); |
| 229 WallpaperManager::Get()->SetCommandLineForTesting(command_line->get()); | 225 WallpaperManager::Get()->SetCommandLineForTesting(command_line->get()); |
| 230 } | 226 } |
| 231 | 227 |
| 232 } // namespace wallpaper_manager_test_utils | 228 } // namespace wallpaper_manager_test_utils |
| 233 | 229 |
| 234 } // namespace chromeos | 230 } // namespace chromeos |
| OLD | NEW |