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 e9a5ad883b99f1bd435042a06d3c3824fb16805b..6b34e4404026b3df787c9b14767a5cccf26d6ac6 100644 |
--- a/chrome/browser/ui/views/frame/taskbar_decorator_win.cc |
+++ b/chrome/browser/ui/views/frame/taskbar_decorator_win.cc |
@@ -16,7 +16,6 @@ |
#include "content/public/browser/browser_thread.h" |
#include "skia/ext/image_operations.h" |
#include "skia/ext/platform_canvas.h" |
-#include "third_party/skia/include/core/SkRect.h" |
#include "ui/gfx/icon_util.h" |
#include "ui/gfx/image/image.h" |
#include "ui/views/win/hwnd_util.h" |
@@ -41,15 +40,20 @@ void SetOverlayIcon(HWND hwnd, scoped_ptr<SkBitmap> bitmap) { |
base::win::ScopedGDIObject<HICON> icon; |
if (bitmap.get()) { |
- const size_t kOverlayIconSize = 16; |
- const SkBitmap* source_bitmap = bitmap.get(); |
+ const SkBitmap source_bitmap = |
sky
2014/05/08 16:04:36
Can you pass this bitmap into the function? That w
Mike Lerman
2014/05/08 18:46:39
Done.
sky
2014/05/08 19:09:55
Sorry if I wasn't being clear. Can you move this c
|
+ profiles::GetAvatarIconAsSquare(*bitmap.get(), 1); |
Mike Lerman
2014/05/08 20:07:32
I'm unsure about the threading issues you're refer
sky
2014/05/08 20:23:51
This function, SetOverlayIcon, is executed on a ba
Mike Lerman
2014/05/09 19:32:06
Done.
|
- // Maintain aspect ratio on resize. Image is assumed to be square. |
+ // 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); |
// Since the target size is so small, we use our best resizer. |
SkBitmap sk_icon = skia::ImageOperations::Resize( |
- *source_bitmap, |
+ source_bitmap, |
skia::ImageOperations::RESIZE_LANCZOS3, |
- kOverlayIconSize, kOverlayIconSize); |
+ kOverlayIconSize, resized_height); |
// Paint the resized icon onto a 16x16 canvas otherwise Windows will badly |
// hammer it to 16x16. |
@@ -57,8 +61,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, 0); |
- |
+ offscreen_canvas.drawBitmap(sk_icon, 0, kOverlayIconSize - resized_height); |
icon.Set(IconUtil::CreateHICONFromSkBitmap(offscreen_bitmap)); |
if (!icon.Get()) |
return; |