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

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

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 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 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
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
OLDNEW
« no previous file with comments | « components/user_manager/user_image/user_image.cc ('k') | components/wallpaper/wallpaper_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698