Index: chrome/browser/ui/views/frame/taskbar_decorator_win.cc |
diff --git a/chrome/browser/ui/views/frame/taskbar_decorator_win.cc b/chrome/browser/ui/views/frame/taskbar_decorator_win.cc |
index f238d05dbe9b1e5aa4f7d031d5ae714aa4e56577..f3a6a566a7a719655903486cfb62ef845083a692 100644 |
--- a/chrome/browser/ui/views/frame/taskbar_decorator_win.cc |
+++ b/chrome/browser/ui/views/frame/taskbar_decorator_win.cc |
@@ -26,6 +26,8 @@ namespace chrome { |
namespace { |
+const size_t kOverlayIconSize = 16; |
Peter Kasting
2014/04/04 20:27:15
Nit: Leave this declared in the narrowest possible
Mike Lerman
2014/04/04 21:09:07
Done.
|
+ |
// Responsible for invoking TaskbarList::SetOverlayIcon(). The call to |
// TaskbarList::SetOverlayIcon() runs a nested message loop that proves |
// problematic when called on the UI thread. Additionally it seems the call may |
@@ -43,32 +45,14 @@ void SetOverlayIcon(HWND hwnd, scoped_ptr<SkBitmap> bitmap) { |
base::win::ScopedGDIObject<HICON> icon; |
if (bitmap.get()) { |
- const SkBitmap* source_bitmap = NULL; |
- SkBitmap squarer_bitmap; |
- if ((bitmap->width() == profiles::kAvatarIconWidth) && |
- (bitmap->height() == profiles::kAvatarIconHeight)) { |
- // Shave a couple of columns so the bitmap is more square. So when |
- // resized to a square aspect ratio it looks pretty. |
- int x = 2; |
- bitmap->extractSubset(&squarer_bitmap, SkIRect::MakeXYWH(x, 0, |
- profiles::kAvatarIconWidth - x * 2, profiles::kAvatarIconHeight)); |
- source_bitmap = &squarer_bitmap; |
- } else { |
- // The image's size has changed. Resize what we have. |
- source_bitmap = bitmap.get(); |
- } |
- |
- // Maintain aspect ratio on resize. It is assumed that the image is wider |
- // than it is tall. |
- const size_t kOverlayIconSize = 16; |
- size_t resized_height = |
- source_bitmap->height() * kOverlayIconSize / source_bitmap->width(); |
- DCHECK_GE(kOverlayIconSize, resized_height); |
+ const SkBitmap* source_bitmap = bitmap.get(); |
+ |
+ // Maintain aspect ratio on resize. Image is assumed to be square. |
// Since the target size is so small, we use our best resizer. |
SkBitmap sk_icon = skia::ImageOperations::Resize( |
*source_bitmap, |
skia::ImageOperations::RESIZE_LANCZOS3, |
- kOverlayIconSize, resized_height); |
+ kOverlayIconSize, kOverlayIconSize); |
// Paint the resized icon onto a 16x16 canvas otherwise Windows will badly |
// hammer it to 16x16. |
@@ -76,7 +60,7 @@ void SetOverlayIcon(HWND hwnd, scoped_ptr<SkBitmap> bitmap) { |
offscreen_bitmap.allocN32Pixels(kOverlayIconSize, kOverlayIconSize); |
SkCanvas offscreen_canvas(offscreen_bitmap); |
offscreen_canvas.clear(SK_ColorTRANSPARENT); |
- offscreen_canvas.drawBitmap(sk_icon, 0, kOverlayIconSize - resized_height); |
+ offscreen_canvas.drawBitmap(sk_icon, 0, 0); |
icon.Set(IconUtil::CreateHICONFromSkBitmap(offscreen_bitmap)); |
if (!icon.Get()) |