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

Unified Diff: trunk/src/chrome/browser/profiles/profile_shortcut_manager_win.cc

Issue 234583008: Revert 263262 "Newly created profiles should have the grey silho..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/profiles/profile_shortcut_manager_win.cc
===================================================================
--- trunk/src/chrome/browser/profiles/profile_shortcut_manager_win.cc (revision 263283)
+++ trunk/src/chrome/browser/profiles/profile_shortcut_manager_win.cc (working copy)
@@ -103,7 +103,6 @@
IDR_PROFILE_AVATAR_2X_23,
IDR_PROFILE_AVATAR_2X_24,
IDR_PROFILE_AVATAR_2X_25,
- IDR_PROFILE_AVATAR_2X_26,
};
// Badges |app_icon_bitmap| with |avatar_bitmap| at the bottom right corner and
@@ -111,17 +110,28 @@
SkBitmap BadgeIcon(const SkBitmap& app_icon_bitmap,
const SkBitmap& avatar_bitmap,
int scale_factor) {
- // All icons, whether cartoon, GAIA or placeholder, should be square.
- DLOG_ASSERT(avatar_bitmap.width() == avatar_bitmap.height());
-
+ // TODO(rlp): Share this chunk of code with
+ // avatar_menu_button::DrawTaskBarDecoration.
+ SkBitmap source_bitmap = avatar_bitmap;
+ if ((avatar_bitmap.width() == scale_factor * profiles::kAvatarIconWidth) &&
+ (avatar_bitmap.height() == scale_factor * profiles::kAvatarIconHeight)) {
+ // Shave a couple of columns so the bitmap is more square. So when
+ // resized to a square aspect ratio it looks pretty.
+ gfx::Rect frame(scale_factor * profiles::kAvatarIconWidth,
+ scale_factor * profiles::kAvatarIconHeight);
+ frame.Inset(scale_factor * 2, 0, scale_factor * 2, 0);
+ avatar_bitmap.extractSubset(&source_bitmap, gfx::RectToSkIRect(frame));
+ } else {
+ NOTREACHED();
+ }
int avatar_badge_size = kProfileAvatarBadgeSize;
if (app_icon_bitmap.width() != kShortcutIconSize) {
avatar_badge_size =
app_icon_bitmap.width() * kProfileAvatarBadgeSize / kShortcutIconSize;
}
SkBitmap sk_icon = skia::ImageOperations::Resize(
- avatar_bitmap, skia::ImageOperations::RESIZE_LANCZOS3, avatar_badge_size,
- avatar_bitmap.height() * avatar_badge_size / avatar_bitmap.width());
+ source_bitmap, skia::ImageOperations::RESIZE_LANCZOS3, avatar_badge_size,
+ source_bitmap.height() * avatar_badge_size / source_bitmap.width());
// Overlay the avatar on the icon, anchoring it to the bottom-right of the
// icon.
« no previous file with comments | « trunk/src/chrome/browser/profiles/profile_metrics.cc ('k') | trunk/src/chrome/browser/profiles/profile_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698