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

Unified Diff: components/favicon_base/select_favicon_frames.h

Issue 2739173002: Always select best favicon bitmap (Closed)
Patch Set: WIP. Created 3 years, 9 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/favicon_base/select_favicon_frames.h
diff --git a/components/favicon_base/select_favicon_frames.h b/components/favicon_base/select_favicon_frames.h
index 573a38c79cddf839622488589b71b4d19fbdfba6..f0f31b6d5811df793e09be04467342f875609fbf 100644
--- a/components/favicon_base/select_favicon_frames.h
+++ b/components/favicon_base/select_favicon_frames.h
@@ -44,6 +44,15 @@ gfx::ImageSkia CreateFaviconImageSkia(
int desired_size_in_dip,
float* score);
+// |desired_scale_factors| can contain 0 to represent that the corresponding
+// image shouldn't be resized. In that case, the scale factor will be computed
+// from |original_sizes|.
+gfx::ImageSkia CreateFaviconImageSkiaWithScaleFactors(
+ const std::vector<SkBitmap>& bitmaps,
+ const std::vector<gfx::Size>& original_sizes,
+ const std::vector<float>& desired_scale_factors,
+ int desired_size_in_dip);
+
// Takes a list of the pixel sizes of a favicon's favicon bitmaps and returns
// the indices of the best sizes to use to create an ImageSkia with
// ImageSkiaReps with edge sizes |desired_sizes|. If '0' is one of
@@ -61,4 +70,13 @@ void SelectFaviconFrameIndices(const std::vector<gfx::Size>& frame_pixel_sizes,
std::vector<size_t>* best_indices,
float* score);
+// Returns an arbitrary, implementation specific score between [0..1] that is
+// higher for better matches, and 1.0f for exact matches. Order of preference:
+// 1) Non-huge bitmaps are preferred over huge ones (8x bigger than
+// desired_size).
+// 2) Bitmaps which need to be scaled down instead of up.
+// 3) Bitmaps which do not need to be scaled as much.
+float GetFaviconCandidateScore(const gfx::Size& candidate_size,
+ int desired_size);
+
#endif // COMPONENTS_FAVICON_BASE_SELECT_FAVICON_FRAMES_H_

Powered by Google App Engine
This is Rietveld 408576698