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. |