OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/base/cursor/cursors_aura.h" | 5 #include "ui/base/cursor/cursors_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 bool GetCursorBitmap(const Cursor& cursor, | 232 bool GetCursorBitmap(const Cursor& cursor, |
233 SkBitmap* bitmap, | 233 SkBitmap* bitmap, |
234 gfx::Point* point) { | 234 gfx::Point* point) { |
235 DCHECK(bitmap && point); | 235 DCHECK(bitmap && point); |
236 #if defined(OS_WIN) | 236 #if defined(OS_WIN) |
237 Cursor cursor_copy = cursor; | 237 Cursor cursor_copy = cursor; |
238 ui::CursorLoaderWin cursor_loader; | 238 ui::CursorLoaderWin cursor_loader; |
239 cursor_loader.SetPlatformCursor(&cursor_copy); | 239 cursor_loader.SetPlatformCursor(&cursor_copy); |
240 const std::unique_ptr<SkBitmap> cursor_bitmap( | 240 const std::unique_ptr<SkBitmap> cursor_bitmap( |
241 IconUtil::CreateSkBitmapFromHICON(cursor_copy.platform())); | 241 IconUtil::CreateSkBitmapFromHICON(cursor_copy.platform())); |
| 242 *point = IconUtil::GetHotSpotFromHICON(cursor_copy.platform()); |
242 #else | 243 #else |
243 int resource_id; | 244 int resource_id; |
244 if (!GetCursorDataFor(ui::CURSOR_SET_NORMAL, | 245 if (!GetCursorDataFor(ui::CURSOR_SET_NORMAL, |
245 cursor.native_type(), | 246 cursor.native_type(), |
246 cursor.device_scale_factor(), | 247 cursor.device_scale_factor(), |
247 &resource_id, | 248 &resource_id, |
248 point)) { | 249 point)) { |
249 return false; | 250 return false; |
250 } | 251 } |
251 | 252 |
252 const SkBitmap* cursor_bitmap = ResourceBundle::GetSharedInstance(). | 253 const SkBitmap* cursor_bitmap = ResourceBundle::GetSharedInstance(). |
253 GetImageSkiaNamed(resource_id)->bitmap(); | 254 GetImageSkiaNamed(resource_id)->bitmap(); |
254 #endif | 255 #endif |
255 if (!cursor_bitmap) | 256 if (!cursor_bitmap) |
256 return false; | 257 return false; |
257 *bitmap = *cursor_bitmap; | 258 *bitmap = *cursor_bitmap; |
258 return true; | 259 return true; |
259 } | 260 } |
260 | 261 |
261 } // namespace ui | 262 } // namespace ui |
OLD | NEW |