Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: components/wallpaper/wallpaper_manager_base.cc

Issue 2895953003: Use SkJpegEncoder in gfx jpeg_codec (Closed)
Patch Set: Remove brackets Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 gfx::JPEGCodec::Encode( 434 gfx::JPEGCodec::Encode(bitmap, kDefaultEncodingQuality, &(*output)->data());
435 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)),
436 gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(),
437 bitmap.width() * bitmap.bytesPerPixel(), kDefaultEncodingQuality,
438 &(*output)->data());
439 435
440 if (output_skia) { 436 if (output_skia) {
441 resized_image.MakeThreadSafe(); 437 resized_image.MakeThreadSafe();
442 *output_skia = resized_image; 438 *output_skia = resized_image;
443 } 439 }
444 440
445 return true; 441 return true;
446 } 442 }
447 443
448 // static 444 // static
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { 1047 void WallpaperManagerBase::CreateSolidDefaultWallpaper() {
1052 loaded_wallpapers_for_test_++; 1048 loaded_wallpapers_for_test_++;
1053 SkBitmap bitmap; 1049 SkBitmap bitmap;
1054 bitmap.allocN32Pixels(1, 1); 1050 bitmap.allocN32Pixels(1, 1);
1055 bitmap.eraseColor(kDefaultWallpaperColor); 1051 bitmap.eraseColor(kDefaultWallpaperColor);
1056 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); 1052 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
1057 default_wallpaper_image_.reset(new user_manager::UserImage(image)); 1053 default_wallpaper_image_.reset(new user_manager::UserImage(image));
1058 } 1054 }
1059 1055
1060 } // namespace wallpaper 1056 } // namespace wallpaper
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698