OLD | NEW |
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_FAVICON_BASE_SELECT_FAVICON_FRAMES_H_ | 5 #ifndef COMPONENTS_FAVICON_BASE_SELECT_FAVICON_FRAMES_H_ |
6 #define COMPONENTS_FAVICON_BASE_SELECT_FAVICON_FRAMES_H_ | 6 #define COMPONENTS_FAVICON_BASE_SELECT_FAVICON_FRAMES_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // matches, and gets worse the more resampling needs to happen. | 54 // matches, and gets worse the more resampling needs to happen. |
55 // TODO(pkotwicz): Change API so that |desired_sizes| being empty indicates | 55 // TODO(pkotwicz): Change API so that |desired_sizes| being empty indicates |
56 // that the index of the largest size is requested. | 56 // that the index of the largest size is requested. |
57 // TODO(pkotwicz): Remove callers of this method for which |frame_pixel_sizes| | 57 // TODO(pkotwicz): Remove callers of this method for which |frame_pixel_sizes| |
58 // are the sizes of the favicon bitmaps after they were resized. | 58 // are the sizes of the favicon bitmaps after they were resized. |
59 void SelectFaviconFrameIndices(const std::vector<gfx::Size>& frame_pixel_sizes, | 59 void SelectFaviconFrameIndices(const std::vector<gfx::Size>& frame_pixel_sizes, |
60 const std::vector<int>& desired_sizes, | 60 const std::vector<int>& desired_sizes, |
61 std::vector<size_t>* best_indices, | 61 std::vector<size_t>* best_indices, |
62 float* score); | 62 float* score); |
63 | 63 |
| 64 // Returns an arbitrary, implementation specific score between [0..1] that is |
| 65 // higher for better matches, and 1.0f for exact matches. Order of preference: |
| 66 // 1) Non-huge bitmaps are preferred over huge ones (8x bigger than |
| 67 // desired_size). |
| 68 // 2) Bitmaps which need to be scaled down instead of up. |
| 69 // 3) Bitmaps which do not need to be scaled as much. |
| 70 float GetFaviconCandidateScore(const gfx::Size& candidate_size, |
| 71 int desired_size); |
| 72 |
64 #endif // COMPONENTS_FAVICON_BASE_SELECT_FAVICON_FRAMES_H_ | 73 #endif // COMPONENTS_FAVICON_BASE_SELECT_FAVICON_FRAMES_H_ |
OLD | NEW |