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

Side by Side Diff: chrome/browser/favicon/favicon_handler.cc

Issue 9477016: Remove all |gfx::Image(new SkBitmap(...))| antipatterns. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « no previous file | chrome/browser/icon_loader_mac.mm » ('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) 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/favicon/favicon_handler.h" 5 #include "chrome/browser/favicon/favicon_handler.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 return download_id; 443 return download_id;
444 } 444 }
445 445
446 gfx::Image FaviconHandler::ResizeFaviconIfNeeded(const gfx::Image& image) { 446 gfx::Image FaviconHandler::ResizeFaviconIfNeeded(const gfx::Image& image) {
447 // Get an SkBitmap from the gfx::Image. 447 // Get an SkBitmap from the gfx::Image.
448 const SkBitmap& bitmap = image; 448 const SkBitmap& bitmap = image;
449 int width = bitmap.width(); 449 int width = bitmap.width();
450 int height = bitmap.height(); 450 int height = bitmap.height();
451 if (width > 0 && height > 0) { 451 if (width > 0 && height > 0) {
452 gfx::CalculateFaviconTargetSize(&width, &height); 452 gfx::CalculateFaviconTargetSize(&width, &height);
453 return gfx::Image(new SkBitmap( 453 return gfx::Image(skia::ImageOperations::Resize(
454 skia::ImageOperations::Resize( 454 bitmap, skia::ImageOperations::RESIZE_LANCZOS3,
455 bitmap, skia::ImageOperations::RESIZE_LANCZOS3, 455 width, height));
456 width, height)));
457 } 456 }
458 457
459 return image; 458 return image;
460 } 459 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/icon_loader_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698