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

Side by Side Diff: ui/gfx/favicon_size.h

Issue 7065052: Improve large tab strip by leveraging touch icons when present (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ' Created 9 years, 6 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
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 #ifndef UI_GFX_FAVICON_SIZE_H_ 5 #ifndef UI_GFX_FAVICON_SIZE_H_
6 #define UI_GFX_FAVICON_SIZE_H_ 6 #define UI_GFX_FAVICON_SIZE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 10
11 // Size (along each axis) of the favicon. 11 // Size (along each axis) of the favicon.
12 #if defined(TOUCH_UI)
13 const int kFaviconSize = 32;
14 #else
15 const int kFaviconSize = 16; 12 const int kFaviconSize = 16;
16 #endif 13
14 // The size of the favicon touch area.
15 const int kTouchTargetIconSize = 32;
sky 2011/06/16 15:43:41 This is only used in the tab strip. Keep it there
Emmanuel Saint-loubert-Bié 2011/06/17 00:01:44 Done.
17 16
18 // If the width or height is bigger than the favicon size, a new width/height 17 // If the width or height is bigger than the favicon size, a new width/height
19 // is calculated and returned in width/height that maintains the aspect 18 // is calculated and returned in width/height that maintains the aspect
20 // ratio of the supplied values. 19 // ratio of the supplied values.
21 static void calc_favicon_target_size(int* width, int* height) ALLOW_UNUSED; 20 static void calc_favicon_target_size(int* width, int* height) ALLOW_UNUSED;
22 21
23 // static 22 // static
24 void calc_favicon_target_size(int* width, int* height) { 23 void calc_favicon_target_size(int* width, int* height) {
25 if (*width > kFaviconSize || *height > kFaviconSize) { 24 if (*width > kFaviconSize || *height > kFaviconSize) {
26 // Too big, resize it maintaining the aspect ratio. 25 // Too big, resize it maintaining the aspect ratio.
27 float aspect_ratio = static_cast<float>(*width) / 26 float aspect_ratio = static_cast<float>(*width) /
28 static_cast<float>(*height); 27 static_cast<float>(*height);
29 *height = kFaviconSize; 28 *height = kFaviconSize;
30 *width = static_cast<int>(aspect_ratio * *height); 29 *width = static_cast<int>(aspect_ratio * *height);
31 if (*width > kFaviconSize) { 30 if (*width > kFaviconSize) {
32 *width = kFaviconSize; 31 *width = kFaviconSize;
33 *height = static_cast<int>(*width / aspect_ratio); 32 *height = static_cast<int>(*width / aspect_ratio);
34 } 33 }
35 } 34 }
36 } 35 }
37 36
38 #endif // UI_GFX_FAVICON_SIZE_H_ 37 #endif // UI_GFX_FAVICON_SIZE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698