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

Unified Diff: ui/app_list/icon_cache.cc

Issue 10699065: chromeos: Fix pixelated icons in app list and launcher (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, move Resize/CreateDropShadow into ImageSkiaSource Created 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/app_list/icon_cache.cc
diff --git a/ui/app_list/icon_cache.cc b/ui/app_list/icon_cache.cc
index b0b9997e6aebc9113232521827a3a0c956fc6e43..b684b88aad5f25e7b89fd3161f18d64374e65f90 100644
--- a/ui/app_list/icon_cache.cc
+++ b/ui/app_list/icon_cache.cc
@@ -11,10 +11,11 @@
namespace {
// Gets cache key based on |image| contents and desired |size|.
-std::string GetKey(const SkBitmap& image, const gfx::Size& size) {
- SkAutoLockPixels image_lock(image);
+std::string GetKey(const gfx::ImageSkia& image, const gfx::Size& size) {
+ const SkBitmap* bitmap = image.bitmap();
pkotwicz 2012/07/04 00:19:50 I think you should call GetRepresentation(ui::SCAL
xiyuan 2012/07/10 20:02:13 We will have to call GetRepresentation in ResizeAn
pkotwicz 2012/07/11 00:12:44 I understand now. The code as you have written is
+ SkAutoLockPixels image_lock(*bitmap);
base::MD5Digest digest;
- MD5Sum(image.getPixels(), image.getSize(), &digest);
+ MD5Sum(bitmap->getPixels(), bitmap->getSize(), &digest);
return MD5DigestToBase16(digest) + "." + size.ToString();
}
@@ -59,9 +60,9 @@ void IconCache::PurgeAllUnused() {
}
}
-bool IconCache::Get(const SkBitmap& src,
+bool IconCache::Get(const gfx::ImageSkia& src,
const gfx::Size& size,
- SkBitmap* processed) {
+ gfx::ImageSkia* processed) {
Cache::iterator it = cache_.find(GetKey(src, size));
if (it == cache_.end())
return false;
@@ -73,9 +74,9 @@ bool IconCache::Get(const SkBitmap& src,
return true;
}
-void IconCache::Put(const SkBitmap& src,
+void IconCache::Put(const gfx::ImageSkia& src,
const gfx::Size& size,
- const SkBitmap& processed) {
+ const gfx::ImageSkia& processed) {
const std::string key = GetKey(src, size);
cache_[key].image = processed;
cache_[key].used = true;

Powered by Google App Engine
This is Rietveld 408576698