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

Side by Side Diff: chrome/browser/history/select_favicon_frames.cc

Issue 10946024: Fix comment numbering (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/history/select_favicon_frames.h" 5 #include "chrome/browser/history/select_favicon_frames.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "skia/ext/image_operations.h" 9 #include "skia/ext/image_operations.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 candidate_sizes[i].height() * scale == source_size) { 115 candidate_sizes[i].height() * scale == source_size) {
116 *score = 0.15f; 116 *score = 0.15f;
117 *resize_method = PAD_WITH_BORDER; 117 *resize_method = PAD_WITH_BORDER;
118 return i; 118 return i;
119 } 119 }
120 } 120 }
121 } 121 }
122 122
123 // 2. Integer multiples are built using nearest neighbor sampling. 123 // 2. Integer multiples are built using nearest neighbor sampling.
124 // 3. Else, use Lancosz scaling: 124 // 3. Else, use Lancosz scaling:
125 // b) If available, from the next bigger variant. 125 // a) If available, from the next bigger variant.
126 int candidate_index = -1; 126 int candidate_index = -1;
127 int min_area = INT_MAX; 127 int min_area = INT_MAX;
128 for (size_t i = 0; i < candidate_sizes.size(); ++i) { 128 for (size_t i = 0; i < candidate_sizes.size(); ++i) {
129 int area = candidate_sizes[i].GetArea(); 129 int area = candidate_sizes[i].GetArea();
130 if (candidate_sizes[i].width() > desired_size && 130 if (candidate_sizes[i].width() > desired_size &&
131 candidate_sizes[i].height() > desired_size && 131 candidate_sizes[i].height() > desired_size &&
132 (candidate_index == -1 || area < min_area)) { 132 (candidate_index == -1 || area < min_area)) {
133 candidate_index = i; 133 candidate_index = i;
134 min_area = area; 134 min_area = area;
135 } 135 }
136 } 136 }
137 *score = 0.1f; 137 *score = 0.1f;
138 // c) Else, from the biggest smaller variant. 138 // b) Else, from the biggest smaller variant.
139 if (candidate_index == -1) { 139 if (candidate_index == -1) {
140 *score = 0; 140 *score = 0;
141 candidate_index = BiggestCandidate(candidate_sizes); 141 candidate_index = BiggestCandidate(candidate_sizes);
142 } 142 }
143 143
144 const gfx::Size& candidate_size = candidate_sizes[candidate_index]; 144 const gfx::Size& candidate_size = candidate_sizes[candidate_index];
145 if (candidate_size.IsEmpty()) { 145 if (candidate_size.IsEmpty()) {
146 *resize_method = NONE; 146 *resize_method = NONE;
147 } else if (desired_size % candidate_size.width() == 0 && 147 } else if (desired_size % candidate_size.width() == 0 &&
148 desired_size % candidate_size.height() == 0) { 148 desired_size % candidate_size.height() == 0) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // GetCandidateIndicesWithBestScores() will return duplicate indices if the 275 // GetCandidateIndicesWithBestScores() will return duplicate indices if the
276 // bitmap data with |frame_pixel_sizes[index]| should be used for multiple 276 // bitmap data with |frame_pixel_sizes[index]| should be used for multiple
277 // scale factors. Remove duplicates here such that |best_indices| contains 277 // scale factors. Remove duplicates here such that |best_indices| contains
278 // no duplicates. 278 // no duplicates.
279 if (already_added.find(index) == already_added.end()) { 279 if (already_added.find(index) == already_added.end()) {
280 already_added.insert(index); 280 already_added.insert(index);
281 best_indices->push_back(index); 281 best_indices->push_back(index);
282 } 282 }
283 } 283 }
284 } 284 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698