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..360b967728138c8239d0e5e7bfd5d398c0c12b4a 100644 |
--- a/ui/app_list/icon_cache.cc |
+++ b/ui/app_list/icon_cache.cc |
@@ -7,14 +7,21 @@ |
#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) { |
+ // TODO(xiyuan): Revisit this after ImageLoadingTracker DIP support is done. |
+ ui::ScaleFactor scale_factor = gfx::Screen::IsDIPEnabled() ? |
+ ui::SCALE_FACTOR_200P : ui::SCALE_FACTOR_100P; |
sky
2012/07/16 16:49:39
How come if dip is enabled this always scales by 2
xiyuan
2012/07/16 17:08:02
This is because we have not yet decided what is th
|
+ 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 +66,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 +80,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; |