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

Unified Diff: components/enhanced_bookmarks/image_store_util.cc

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.cc
diff --git a/components/enhanced_bookmarks/image_store_util.cc b/components/enhanced_bookmarks/image_store_util.cc
index 213b5950fe516290d094cc7b0a8f53b793027cf2..ef3979d90902c104cfe03b47aecfde7d71201372 100644
--- a/components/enhanced_bookmarks/image_store_util.cc
+++ b/components/enhanced_bookmarks/image_store_util.cc
@@ -4,6 +4,8 @@
#include "components/enhanced_bookmarks/image_store_util.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/color_analysis.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_util.h"
@@ -30,4 +32,8 @@ scoped_refptr<base::RefCountedMemory> BytesForImage(const gfx::Image& image) {
gfx::Image ImageForBytes(const scoped_refptr<base::RefCountedMemory>& bytes) {
return gfx::ImageFrom1xJPEGEncodedData(bytes->front(), bytes->size());
}
+
+SkColor DominantColorForImage(const gfx::Image& image) {
+ return color_utils::CalculateKMeanColorOfBitmap(*image.ToSkBitmap());
+}
}
« no previous file with comments | « components/enhanced_bookmarks/image_store_util.h ('k') | components/enhanced_bookmarks/image_store_util_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698