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

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

Issue 15388002: Supporting high dpi favicons in Instant Extended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments & removing searchbox changes Created 7 years, 5 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
« ui/gfx/favicon_size.h ('K') | « ui/gfx/favicon_size.h ('k') | no next file » | 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 "ui/gfx/favicon_size.h" 5 #include "ui/gfx/favicon_size.h"
6 6
7 namespace gfx { 7 namespace gfx {
8 8
9 const int kFaviconSize = 16; 9 const int kFaviconSize = 16;
10 10
11 const int kSizeInDip = kFaviconSize;
12
13 const int kSizeInDip2x = kFaviconSize * 2;
14
15 const int kSizeInDip4x = kFaviconSize * 4;
16
11 void CalculateFaviconTargetSize(int* width, int* height) { 17 void CalculateFaviconTargetSize(int* width, int* height) {
12 if (*width > kFaviconSize || *height > kFaviconSize) { 18 if (*width > kFaviconSize || *height > kFaviconSize) {
13 // Too big, resize it maintaining the aspect ratio. 19 // Too big, resize it maintaining the aspect ratio.
14 float aspect_ratio = static_cast<float>(*width) / 20 float aspect_ratio = static_cast<float>(*width) /
15 static_cast<float>(*height); 21 static_cast<float>(*height);
16 *height = kFaviconSize; 22 *height = kFaviconSize;
17 *width = static_cast<int>(aspect_ratio * *height); 23 *width = static_cast<int>(aspect_ratio * *height);
18 if (*width > kFaviconSize) { 24 if (*width > kFaviconSize) {
19 *width = kFaviconSize; 25 *width = kFaviconSize;
20 *height = static_cast<int>(*width / aspect_ratio); 26 *height = static_cast<int>(*width / aspect_ratio);
21 } 27 }
22 } 28 }
23 } 29 }
24 30
25 } // namespace gfx 31 } // namespace gfx
OLDNEW
« ui/gfx/favicon_size.h ('K') | « ui/gfx/favicon_size.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698