Commit 5ca4d040 authored by pkotwicz@chromium.org's avatar pkotwicz@chromium.org

Never decode the favicon in FaviconUtil::SelectFaviconFramesFromPNGs() to...

Never decode the favicon in FaviconUtil::SelectFaviconFramesFromPNGs() to SkBitmap when the desired size is 0. The decoding is unnecessary.
Giving the largest PNG a scale factor of 100P matches the behavior in SelectFaviconFrames().
This is a corner case that I need to fix in order fix 278457

BUG=278457
TEST=None

Review URL: https://chromiumcodereview.appspot.com/23569008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222070 0039d316-1c4b-4281-b951-d872f2087c98
parent bebd8e7b
......@@ -32,7 +32,7 @@ std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing(
return png_reps;
// A |favicon_size| of 0 indicates that the largest frame is desired.
if (favicon_size == 0 && scale_factors.size() == 1) {
if (favicon_size == 0) {
int maximum_area = 0;
scoped_refptr<base::RefCountedMemory> best_candidate;
for (size_t i = 0; i < png_data.size(); ++i) {
......@@ -43,7 +43,7 @@ std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing(
}
}
png_reps.push_back(gfx::ImagePNGRep(best_candidate,
scale_factors[0]));
ui::SCALE_FACTOR_100P));
return png_reps;
}
......@@ -134,6 +134,11 @@ gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs(
SelectFaviconFramesFromPNGsWithoutResizing(png_data, scale_factors,
favicon_size);
// SelectFaviconFramesFromPNGsWithoutResizing() should have selected the
// largest favicon if |favicon_size| == 0.
if (favicon_size == 0)
return gfx::Image(png_reps);
std::vector<ui::ScaleFactor> scale_factors_to_generate = scale_factors;
for (size_t i = 0; i < png_reps.size(); ++i) {
std::vector<ui::ScaleFactor>::iterator it = std::find(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment