| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 } else { | 424 } else { |
| 425 resized_width = width; | 425 resized_width = width; |
| 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 SkAutoLockPixels lock_input(bitmap); | |
| 435 gfx::JPEGCodec::Encode( | 434 gfx::JPEGCodec::Encode( |
| 436 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), | 435 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), |
| 437 gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(), | 436 gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(), |
| 438 bitmap.width() * bitmap.bytesPerPixel(), kDefaultEncodingQuality, | 437 bitmap.width() * bitmap.bytesPerPixel(), kDefaultEncodingQuality, |
| 439 &(*output)->data()); | 438 &(*output)->data()); |
| 440 | 439 |
| 441 if (output_skia) { | 440 if (output_skia) { |
| 442 resized_image.MakeThreadSafe(); | 441 resized_image.MakeThreadSafe(); |
| 443 *output_skia = resized_image; | 442 *output_skia = resized_image; |
| 444 } | 443 } |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { | 1054 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { |
| 1056 loaded_wallpapers_for_test_++; | 1055 loaded_wallpapers_for_test_++; |
| 1057 SkBitmap bitmap; | 1056 SkBitmap bitmap; |
| 1058 bitmap.allocN32Pixels(1, 1); | 1057 bitmap.allocN32Pixels(1, 1); |
| 1059 bitmap.eraseColor(kDefaultWallpaperColor); | 1058 bitmap.eraseColor(kDefaultWallpaperColor); |
| 1060 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 1059 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
| 1061 default_wallpaper_image_.reset(new user_manager::UserImage(image)); | 1060 default_wallpaper_image_.reset(new user_manager::UserImage(image)); |
| 1062 } | 1061 } |
| 1063 | 1062 |
| 1064 } // namespace wallpaper | 1063 } // namespace wallpaper |
| OLD | NEW |