| 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 #include "components/favicon_base/select_favicon_frames.h" | 5 #include "components/favicon_base/select_favicon_frames.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "components/favicon_base/favicon_util.h" | 13 #include "components/favicon_base/favicon_util.h" |
| 14 #include "skia/ext/image_operations.h" | 14 #include "skia/ext/image_operations.h" |
| 15 #include "third_party/skia/include/core/SkCanvas.h" | 15 #include "third_party/skia/include/core/SkCanvas.h" |
| 16 #include "ui/gfx/geometry/size.h" |
| 16 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
| 17 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
| 18 #include "ui/gfx/image/image_skia_source.h" | 19 #include "ui/gfx/image/image_skia_source.h" |
| 19 #include "ui/gfx/size.h" | |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 size_t BiggestCandidate(const std::vector<gfx::Size>& candidate_sizes) { | 23 size_t BiggestCandidate(const std::vector<gfx::Size>& candidate_sizes) { |
| 24 size_t max_index = 0; | 24 size_t max_index = 0; |
| 25 int max_area = candidate_sizes[0].GetArea(); | 25 int max_area = candidate_sizes[0].GetArea(); |
| 26 for (size_t i = 1; i < candidate_sizes.size(); ++i) { | 26 for (size_t i = 1; i < candidate_sizes.size(); ++i) { |
| 27 int area = candidate_sizes[i].GetArea(); | 27 int area = candidate_sizes[i].GetArea(); |
| 28 if (area > max_area) { | 28 if (area > max_area) { |
| 29 max_area = area; | 29 max_area = area; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // GetCandidateIndicesWithBestScores() will return duplicate indices if the | 271 // GetCandidateIndicesWithBestScores() will return duplicate indices if the |
| 272 // bitmap data with |frame_pixel_sizes[index]| should be used for multiple | 272 // bitmap data with |frame_pixel_sizes[index]| should be used for multiple |
| 273 // scale factors. Remove duplicates here such that |best_indices| contains | 273 // scale factors. Remove duplicates here such that |best_indices| contains |
| 274 // no duplicates. | 274 // no duplicates. |
| 275 if (already_added.find(index) == already_added.end()) { | 275 if (already_added.find(index) == already_added.end()) { |
| 276 already_added.insert(index); | 276 already_added.insert(index); |
| 277 best_indices->push_back(index); | 277 best_indices->push_back(index); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 } | 280 } |
| OLD | NEW |