Chromium Code Reviews| Index: ui/gfx/icon_util.cc |
| diff --git a/ui/gfx/icon_util.cc b/ui/gfx/icon_util.cc |
| index 1dbf77f6008d92c39aff65b92fa30c575c9dcdcd..54b7ed8b6de031ffd7354a3071a4a0f296d8c9e0 100644 |
| --- a/ui/gfx/icon_util.cc |
| +++ b/ui/gfx/icon_util.cc |
| @@ -311,7 +311,12 @@ SkBitmap* IconUtil::CreateSkBitmapFromHICON(HICON icon) { |
| if (!::GetObject(icon_info.hbmMask, sizeof(bitmap_info), &bitmap_info)) |
| return NULL; |
| - gfx::Size icon_size(bitmap_info.bmWidth, bitmap_info.bmHeight); |
| + // For non-color cursors, the mask contains both an AND and an XOR mask and |
| + // the height includes both. Thus, the mask width is the same as image width, |
| + // but we need to divide mask height by 2 to get the image height. |
| + const int height = (icon_info.hbmColor == NULL) ? bitmap_info.bmHeight / 2 |
|
msw
2016/10/20 18:54:51
nit: just check: "icon_info.hbmColor ?" otherwise,
qiangchen
2016/10/20 20:03:33
Done.
msw
2016/10/20 20:06:58
Thanks for catching and fixing the inversion error
|
| + : bitmap_info.bmHeight; |
| + gfx::Size icon_size(bitmap_info.bmWidth, height); |
| return new SkBitmap(CreateSkBitmapFromHICONHelper(icon, icon_size)); |
| } |