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

Side by Side Diff: chrome/browser/importer/importer.cc

Issue 6681041: fav icon -> favicon. Pass 3: kFavIconSize -> kFaviconSize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/fav_icon_helper.cc ('k') | chrome/browser/search_engines/template_url.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/importer/importer.h" 5 #include "chrome/browser/importer/importer.h"
6 6
7 #include "chrome/browser/importer/importer_bridge.h" 7 #include "chrome/browser/importer/importer_bridge.h"
8 #include "chrome/browser/importer/importer_data_types.h" 8 #include "chrome/browser/importer/importer_data_types.h"
9 #include "skia/ext/image_operations.h" 9 #include "skia/ext/image_operations.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 Importer::~Importer() { 25 Importer::~Importer() {
26 } 26 }
27 27
28 // static 28 // static
29 bool Importer::ReencodeFavicon(const unsigned char* src_data, 29 bool Importer::ReencodeFavicon(const unsigned char* src_data,
30 size_t src_len, 30 size_t src_len,
31 std::vector<unsigned char>* png_data) { 31 std::vector<unsigned char>* png_data) {
32 // Decode the favicon using WebKit's image decoder. 32 // Decode the favicon using WebKit's image decoder.
33 webkit_glue::ImageDecoder decoder(gfx::Size(kFavIconSize, kFavIconSize)); 33 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize));
34 SkBitmap decoded = decoder.Decode(src_data, src_len); 34 SkBitmap decoded = decoder.Decode(src_data, src_len);
35 if (decoded.empty()) 35 if (decoded.empty())
36 return false; // Unable to decode. 36 return false; // Unable to decode.
37 37
38 if (decoded.width() != kFavIconSize || decoded.height() != kFavIconSize) { 38 if (decoded.width() != kFaviconSize || decoded.height() != kFaviconSize) {
39 // The bitmap is not the correct size, re-sample. 39 // The bitmap is not the correct size, re-sample.
40 int new_width = decoded.width(); 40 int new_width = decoded.width();
41 int new_height = decoded.height(); 41 int new_height = decoded.height();
42 calc_favicon_target_size(&new_width, &new_height); 42 calc_favicon_target_size(&new_width, &new_height);
43 decoded = skia::ImageOperations::Resize( 43 decoded = skia::ImageOperations::Resize(
44 decoded, skia::ImageOperations::RESIZE_LANCZOS3, new_width, new_height); 44 decoded, skia::ImageOperations::RESIZE_LANCZOS3, new_width, new_height);
45 } 45 }
46 46
47 // Encode our bitmap as a PNG. 47 // Encode our bitmap as a PNG.
48 gfx::PNGCodec::EncodeBGRASkBitmap(decoded, false, png_data); 48 gfx::PNGCodec::EncodeBGRASkBitmap(decoded, false, png_data);
49 return true; 49 return true;
50 } 50 }
OLDNEW
« no previous file with comments | « chrome/browser/fav_icon_helper.cc ('k') | chrome/browser/search_engines/template_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698