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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 | 231 |
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 scoped_ptr<SkBitmap> cursor_bitmap(IconUtil::CreateSkBitmapFromHICON( | 240 const std::unique_ptr<SkBitmap> cursor_bitmap( |
241 cursor_copy.platform())); | 241 IconUtil::CreateSkBitmapFromHICON(cursor_copy.platform())); |
242 #else | 242 #else |
243 int resource_id; | 243 int resource_id; |
244 if (!GetCursorDataFor(ui::CURSOR_SET_NORMAL, | 244 if (!GetCursorDataFor(ui::CURSOR_SET_NORMAL, |
245 cursor.native_type(), | 245 cursor.native_type(), |
246 cursor.device_scale_factor(), | 246 cursor.device_scale_factor(), |
247 &resource_id, | 247 &resource_id, |
248 point)) { | 248 point)) { |
249 return false; | 249 return false; |
250 } | 250 } |
251 | 251 |
252 const SkBitmap* cursor_bitmap = ResourceBundle::GetSharedInstance(). | 252 const SkBitmap* cursor_bitmap = ResourceBundle::GetSharedInstance(). |
253 GetImageSkiaNamed(resource_id)->bitmap(); | 253 GetImageSkiaNamed(resource_id)->bitmap(); |
254 #endif | 254 #endif |
255 if (!cursor_bitmap) | 255 if (!cursor_bitmap) |
256 return false; | 256 return false; |
257 *bitmap = *cursor_bitmap; | 257 *bitmap = *cursor_bitmap; |
258 return true; | 258 return true; |
259 } | 259 } |
260 | 260 |
261 } // namespace ui | 261 } // namespace ui |
OLD | NEW |