| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/corewm/cursor_height_provider_win.h" | 5 #include "ui/views/corewm/cursor_height_provider_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 GetIconInfo(cursor_handle, &icon); | 84 GetIconInfo(cursor_handle, &icon); |
| 85 | 85 |
| 86 BITMAPINFO bitmap_info = {0}; | 86 BITMAPINFO bitmap_info = {0}; |
| 87 bitmap_info.bmiHeader.biSize = sizeof(bitmap_info.bmiHeader); | 87 bitmap_info.bmiHeader.biSize = sizeof(bitmap_info.bmiHeader); |
| 88 if (GetDIBits(hdc, icon.hbmMask, 0, 0, NULL, &bitmap_info, DIB_RGB_COLORS) == | 88 if (GetDIBits(hdc, icon.hbmMask, 0, 0, NULL, &bitmap_info, DIB_RGB_COLORS) == |
| 89 0) | 89 0) |
| 90 return kDefaultHeight; | 90 return kDefaultHeight; |
| 91 | 91 |
| 92 // Rows are padded to full DWORDs. OR with this mask will set them to 1 | 92 // Rows are padded to full DWORDs. OR with this mask will set them to 1 |
| 93 // to simplify matching with |transparent_mask|. | 93 // to simplify matching with |transparent_mask|. |
| 94 uint32_t last_byte_mask = ~0; | 94 uint32_t last_byte_mask = 0xFFFFFFFF; |
| 95 const unsigned char bits_to_shift = sizeof(last_byte_mask) * 8 - | 95 const unsigned char bits_to_shift = sizeof(last_byte_mask) * 8 - |
| 96 (bitmap_info.bmiHeader.biWidth % kBitsPeruint32); | 96 (bitmap_info.bmiHeader.biWidth % kBitsPeruint32); |
| 97 if (bits_to_shift != kBitsPeruint32) | 97 if (bits_to_shift != kBitsPeruint32) |
| 98 last_byte_mask = (last_byte_mask << bits_to_shift); | 98 last_byte_mask = (last_byte_mask << bits_to_shift); |
| 99 else | 99 else |
| 100 last_byte_mask = 0; | 100 last_byte_mask = 0; |
| 101 | 101 |
| 102 const uint32_t row_size = | 102 const uint32_t row_size = |
| 103 (bitmap_info.bmiHeader.biWidth + kBitsPeruint32 - 1) / kBitsPeruint32; | 103 (bitmap_info.bmiHeader.biWidth + kBitsPeruint32 - 1) / kBitsPeruint32; |
| 104 PixelData data(GetBitmapData(icon.hbmMask, bitmap_info, hdc)); | 104 PixelData data(GetBitmapData(icon.hbmMask, bitmap_info, hdc)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 return cached_height->second; | 137 return cached_height->second; |
| 138 | 138 |
| 139 const int height = CalculateCursorHeight(cursor.hCursor); | 139 const int height = CalculateCursorHeight(cursor.hCursor); |
| 140 (*cached_heights)[cursor.hCursor] = height; | 140 (*cached_heights)[cursor.hCursor] = height; |
| 141 | 141 |
| 142 return height; | 142 return height; |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace corewm | 145 } // namespace corewm |
| 146 } // namespace views | 146 } // namespace views |
| OLD | NEW |