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

Side by Side Diff: components/enhanced_bookmarks/image_store_util.h

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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_STORE_UTIL_H_ 5 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_STORE_UTIL_H_
6 #define COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_STORE_UTIL_H_ 6 #define COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_STORE_UTIL_H_
7 7
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "third_party/skia/include/core/SkColor.h"
9 #include "ui/gfx/geometry/size.h" 10 #include "ui/gfx/geometry/size.h"
10 #include "ui/gfx/image/image.h" 11 #include "ui/gfx/image/image.h"
11 12
12 namespace enhanced_bookmarks { 13 namespace enhanced_bookmarks {
13 // The two methods below archive and unarchive an image to and from a bag of 14 // The two methods below archive and unarchive an image to and from a bag of
14 // bytes. There is no API on gfx::Image capable of doing it while preserving the 15 // bytes. There is no API on gfx::Image capable of doing it while preserving the
15 // scale of the image. 16 // scale of the image.
16 17
17 // Encode |image| to bytes, that can be decoded using the below |ImageForBytes| 18 // Encode |image| to bytes, that can be decoded using the below |ImageForBytes|
18 // function. If encoding fails, then returned scoped_refptr has NULL. 19 // function. If encoding fails, then returned scoped_refptr has NULL.
19 scoped_refptr<base::RefCountedMemory> BytesForImage(const gfx::Image& image); 20 scoped_refptr<base::RefCountedMemory> BytesForImage(const gfx::Image& image);
20 21
21 // Decode the image bytes encoded by the above |BytesForImage| function and 22 // Decode the image bytes encoded by the above |BytesForImage| function and
22 // returns a gfx::Image. If decoding fails, returns an empty image. 23 // returns a gfx::Image. If decoding fails, returns an empty image.
23 gfx::Image ImageForBytes(const scoped_refptr<base::RefCountedMemory>& data); 24 gfx::Image ImageForBytes(const scoped_refptr<base::RefCountedMemory>& data);
24 25
26 // Returns the dominant color for |image|. This method can be slow on very large
27 // images.
28 SkColor DominantColorForImage(const gfx::Image& image);
25 } 29 }
26 30
27 #endif // COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_STORE_UTIL_H_ 31 #endif // COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_STORE_UTIL_H_
OLDNEW
« no previous file with comments | « components/enhanced_bookmarks/image_store_unittest.cc ('k') | components/enhanced_bookmarks/image_store_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698