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

Unified Diff: components/enhanced_bookmarks/image_store_util_ios.mm

Issue 875463003: ★ Record the image dominant color in the image database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN Created 5 years, 11 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: components/enhanced_bookmarks/image_store_util_ios.mm
diff --git a/components/enhanced_bookmarks/image_store_util_ios.mm b/components/enhanced_bookmarks/image_store_util_ios.mm
index 5d027cbaaaef195aba1b8abe53ee07ef8a81e83b..98a08dbc7f34124de20d5076400ee47c0e7ede11 100644
--- a/components/enhanced_bookmarks/image_store_util_ios.mm
+++ b/components/enhanced_bookmarks/image_store_util_ios.mm
@@ -8,6 +8,8 @@
#include "base/mac/scoped_cftyperef.h"
#include "base/mac/scoped_nsobject.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/color_analysis.h"
namespace {
// An implementation of RefCountedMemory, where the bytes are stored in a
@@ -45,4 +47,8 @@ gfx::Image ImageForBytes(const scoped_refptr<base::RefCountedMemory>& data) {
[NSData dataWithBytes:data->front() length:data->size()]] retain]);
}
+SkColor DominantColorForImage(const gfx::Image& image) {
+ return color_utils::CalculateKMeanColorOfBitmap(*image.ToSkBitmap());
+}
+
} // namespace enhanced_bookmarks
« no previous file with comments | « components/enhanced_bookmarks/image_store_util.cc ('k') | components/enhanced_bookmarks/persistent_image_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698