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

Unified Diff: chrome/browser/chromeos/login/wallpaper_manager.cc

Issue 10820049: Load 2x resources on demand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated comment Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/wallpaper_manager.cc
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc
index 4f9351fa816dfd6323ae9aafcde387309ccdee12..dafb1b0fab51a15a9053a6d201c7d117e8364f66 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
@@ -76,27 +76,10 @@ gfx::ImageSkia GetWallpaperThumbnail(const gfx::ImageSkia& wallpaper) {
skia::ImageOperations::RESIZE_LANCZOS3,
gfx::Size(kThumbnailWidth, kThumbnailHeight));
- // Ideally, this would call thumbnail.GetRepresentations(). But since that
- // isn't exposed on non-mac yet, we have to do this here.
- std::vector<ui::ScaleFactor> scales = ui::GetSupportedScaleFactors();
- for (size_t i = 0; i < scales.size(); ++i) {
- if (wallpaper.HasRepresentation(scales[i]))
- thumbnail.GetRepresentation(scales[i]);
- }
-
+ thumbnail.MakeThreadSafe();
return thumbnail;
}
-gfx::ImageSkia ImageSkiaDeepCopy(const gfx::ImageSkia& image) {
- gfx::ImageSkia copy;
- std::vector<gfx::ImageSkiaRep> reps = image.image_reps();
- for (std::vector<gfx::ImageSkiaRep>::iterator iter = reps.begin();
- iter != reps.end(); ++iter) {
- copy.AddRepresentation(*iter);
- }
- return copy;
-}
-
} // namespace
namespace chromeos {
@@ -205,7 +188,7 @@ gfx::ImageSkia WallpaperManager::GetCustomWallpaperThumbnail(
const std::string& email) {
CustomWallpaperMap::const_iterator it =
custom_wallpaper_thumbnail_cache_.find(email);
- if (it != wallpaper_cache_.end())
+ if (it != custom_wallpaper_thumbnail_cache_.end())
return (*it).second;
else
return gfx::ImageSkia();
@@ -626,7 +609,7 @@ void WallpaperManager::CacheWallpaper(const std::string& email,
FROM_HERE,
base::Bind(&WallpaperManager::CacheThumbnail,
base::Unretained(this), email,
- ImageSkiaDeepCopy(wallpaper.image())));
+ wallpaper.image().DeepCopy()));
wallpaper_cache_.insert(std::make_pair(email, wallpaper.image()));
}
@@ -668,8 +651,7 @@ void WallpaperManager::FetchWallpaper(const std::string& email,
FROM_HERE,
base::Bind(&WallpaperManager::CacheThumbnail,
base::Unretained(this), email,
- ImageSkiaDeepCopy(wallpaper.image())));
-
+ wallpaper.image().DeepCopy()));
wallpaper_cache_.insert(std::make_pair(email, wallpaper.image()));
ash::Shell::GetInstance()->desktop_background_controller()->
SetCustomWallpaper(wallpaper.image(), layout);
« no previous file with comments | « chrome/browser/chromeos/login/user_image_loader.cc ('k') | chrome/browser/extensions/image_loading_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698