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

Side by Side Diff: chrome/common/gfx/favicon_size.h

Issue 115012: Move: drag_drop_types, favicon_size, icon_util, insets, path, message_box_fla... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 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/common/drag_drop_types.cc ('k') | chrome/common/gfx/icon_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_GFX_FAVICON_SIZE_H__
6 #define CHROME_COMMON_GFX_FAVICON_SIZE_H__
7
8 #include "base/compiler_specific.h"
9
10 // Size (along each axis) of the favicon.
11 const int kFavIconSize = 16;
12
13 // If the width or height is bigger than the favicon size, a new width/height
14 // is calculated and returned in width/height that maintains the aspect
15 // ratio of the supplied values.
16 static void calc_favicon_target_size(int* width, int* height) ALLOW_UNUSED;
17
18 // static
19 void calc_favicon_target_size(int* width, int* height) {
20 if (*width > kFavIconSize || *height > kFavIconSize) {
21 // Too big, resize it maintaining the aspect ratio.
22 float aspect_ratio = static_cast<float>(*width) /
23 static_cast<float>(*height);
24 *height = kFavIconSize;
25 *width = static_cast<int>(aspect_ratio * *height);
26 if (*width > kFavIconSize) {
27 *width = kFavIconSize;
28 *height = static_cast<int>(*width / aspect_ratio);
29 }
30 }
31 }
32
33 #endif // CHROME_COMMON_GFX_FAVICON_SIZE_H__
OLDNEW
« no previous file with comments | « chrome/common/drag_drop_types.cc ('k') | chrome/common/gfx/icon_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698