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

Side by Side Diff: gfx/favicon_size.h

Issue 6246027: Move src/gfx/ to src/ui/gfx... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 | « gfx/empty.cc ('k') | gfx/font.h » ('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) 2006-2008 The Chromium Authors. All rights reserved. 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 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 #ifndef APP_GFX_FAVICON_SIZE_H_ 5 #ifndef APP_GFX_FAVICON_SIZE_H_
6 #define APP_GFX_FAVICON_SIZE_H_ 6 #define APP_GFX_FAVICON_SIZE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "ui/gfx/favicon_size.h"
10 10 // TODO(sail): remove this file once all includes have been updated.
11 // Size (along each axis) of the favicon.
12 const int kFavIconSize = 16;
13
14 // If the width or height is bigger than the favicon size, a new width/height
15 // is calculated and returned in width/height that maintains the aspect
16 // ratio of the supplied values.
17 static void calc_favicon_target_size(int* width, int* height) ALLOW_UNUSED;
18
19 // static
20 void calc_favicon_target_size(int* width, int* height) {
21 if (*width > kFavIconSize || *height > kFavIconSize) {
22 // Too big, resize it maintaining the aspect ratio.
23 float aspect_ratio = static_cast<float>(*width) /
24 static_cast<float>(*height);
25 *height = kFavIconSize;
26 *width = static_cast<int>(aspect_ratio * *height);
27 if (*width > kFavIconSize) {
28 *width = kFavIconSize;
29 *height = static_cast<int>(*width / aspect_ratio);
30 }
31 }
32 }
33 11
34 #endif // APP_GFX_FAVICON_SIZE_H_ 12 #endif // APP_GFX_FAVICON_SIZE_H_
OLDNEW
« no previous file with comments | « gfx/empty.cc ('k') | gfx/font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698