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..f4f7da29de24b8561512df6846f83d0d7b7e4d3e 100644 |
--- a/ui/app_list/icon_cache.cc |
+++ b/ui/app_list/icon_cache.cc |
@@ -7,14 +7,20 @@ |
#include "base/logging.h" |
#include "base/md5.h" |
#include "ui/gfx/size.h" |
+#include "ui/gfx/screen.h" |
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) { |
+ ui::ScaleFactor scale_factor = gfx::Screen::IsDIPEnabled() ? |
+ ui::SCALE_FACTOR_200P : ui::SCALE_FACTOR_NONE; |
oshima
2012/07/11 23:11:16
I think ui::SCALE_FACTOR_100P is good enough.
xiyuan
2012/07/11 23:21:25
Done.
|
+ const gfx::ImageSkiaRep& image_rep = image.GetRepresentation(scale_factor); |
+ DCHECK(!image_rep.is_null()); |
+ const SkBitmap& bitmap = image_rep.sk_bitmap(); |
+ 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 +65,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 +79,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; |