Chromium Code Reviews| 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; |