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

Side by Side Diff: chrome/browser/profiles/profile_info_util.cc

Issue 149513007: [Mac] The GAIA profile photo should be resized in the Users controller menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
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/profiles/profile_info_util.h" 5 #include "chrome/browser/profiles/profile_info_util.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "third_party/skia/include/core/SkPaint.h" 8 #include "third_party/skia/include/core/SkPaint.h"
9 #include "third_party/skia/include/core/SkPath.h" 9 #include "third_party/skia/include/core/SkPath.h"
10 #include "third_party/skia/include/core/SkScalar.h" 10 #include "third_party/skia/include/core/SkScalar.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Draw up to the top-right. 146 // Draw up to the top-right.
147 path.rLineTo(SkIntToScalar(0), SkFloatToScalar(-size_ + 1.5f)); 147 path.rLineTo(SkIntToScalar(0), SkFloatToScalar(-size_ + 1.5f));
148 148
149 paint.setColor(highlight_color); 149 paint.setColor(highlight_color);
150 canvas->DrawPath(path, paint); 150 canvas->DrawPath(path, paint);
151 } 151 }
152 } 152 }
153 153
154 } // namespace internal 154 } // namespace internal
155 155
156 bool AvatarIconNeedsResizing(const gfx::Image& image) {
157 return image.Width() > kAvatarIconWidth || image.Height() > kAvatarIconHeight;
158 }
159
156 gfx::Image GetSizedAvatarIconWithBorder(const gfx::Image& image, 160 gfx::Image GetSizedAvatarIconWithBorder(const gfx::Image& image,
157 bool is_rectangle, 161 bool is_rectangle,
158 int width, int height) { 162 int width, int height) {
159 if (!is_rectangle) 163 if (!is_rectangle)
160 return image; 164 return image;
161 165
162 gfx::Size size(width, height); 166 gfx::Size size(width, height);
163 167
164 // Source for a centered, sized icon with a border. 168 // Source for a centered, sized icon with a border.
165 scoped_ptr<gfx::ImageSkiaSource> source( 169 scoped_ptr<gfx::ImageSkiaSource> source(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 *image.ToImageSkia(), 220 *image.ToImageSkia(),
217 dst_size, 221 dst_size,
218 size, 222 size,
219 internal::AvatarImageSource::POSITION_BOTTOM_CENTER, 223 internal::AvatarImageSource::POSITION_BOTTOM_CENTER,
220 internal::AvatarImageSource::BORDER_ETCHED)); 224 internal::AvatarImageSource::BORDER_ETCHED));
221 225
222 return gfx::Image(gfx::ImageSkia(source.release(), dst_size)); 226 return gfx::Image(gfx::ImageSkia(source.release(), dst_size));
223 } 227 }
224 228
225 } // namespace profiles 229 } // namespace profiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698