| 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 "components/wallpaper/wallpaper_manager_base.h" | 5 #include "components/wallpaper/wallpaper_manager_base.h" |
| 6 | 6 |
| 7 #include <numeric> | 7 #include <numeric> |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 resized_height = height; | 426 resized_height = height; |
| 427 } | 427 } |
| 428 | 428 |
| 429 gfx::ImageSkia resized_image = gfx::ImageSkiaOperations::CreateResizedImage( | 429 gfx::ImageSkia resized_image = gfx::ImageSkiaOperations::CreateResizedImage( |
| 430 image, skia::ImageOperations::RESIZE_LANCZOS3, | 430 image, skia::ImageOperations::RESIZE_LANCZOS3, |
| 431 gfx::Size(resized_width, resized_height)); | 431 gfx::Size(resized_width, resized_height)); |
| 432 | 432 |
| 433 SkBitmap bitmap = *(resized_image.bitmap()); | 433 SkBitmap bitmap = *(resized_image.bitmap()); |
| 434 gfx::JPEGCodec::Encode( | 434 gfx::JPEGCodec::Encode( |
| 435 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), | 435 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), |
| 436 gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(), | 436 kN32_SkColorType, bitmap.width(), bitmap.height(), |
| 437 bitmap.width() * bitmap.bytesPerPixel(), kDefaultEncodingQuality, | 437 bitmap.width() * bitmap.bytesPerPixel(), kDefaultEncodingQuality, |
| 438 &(*output)->data()); | 438 &(*output)->data()); |
| 439 | 439 |
| 440 if (output_skia) { | 440 if (output_skia) { |
| 441 resized_image.MakeThreadSafe(); | 441 resized_image.MakeThreadSafe(); |
| 442 *output_skia = resized_image; | 442 *output_skia = resized_image; |
| 443 } | 443 } |
| 444 | 444 |
| 445 return true; | 445 return true; |
| 446 } | 446 } |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { | 1051 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { |
| 1052 loaded_wallpapers_for_test_++; | 1052 loaded_wallpapers_for_test_++; |
| 1053 SkBitmap bitmap; | 1053 SkBitmap bitmap; |
| 1054 bitmap.allocN32Pixels(1, 1); | 1054 bitmap.allocN32Pixels(1, 1); |
| 1055 bitmap.eraseColor(kDefaultWallpaperColor); | 1055 bitmap.eraseColor(kDefaultWallpaperColor); |
| 1056 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 1056 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
| 1057 default_wallpaper_image_.reset(new user_manager::UserImage(image)); | 1057 default_wallpaper_image_.reset(new user_manager::UserImage(image)); |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 } // namespace wallpaper | 1060 } // namespace wallpaper |
| OLD | NEW |