Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: ui/base/cursor/cursors_aura.cc

Issue 2605773002: Fix Aura can't provide accurate cursor hotspot info. (Closed)
Patch Set: restore logic in SearchTable() Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/cursor/cursor_loader_x11.cc ('k') | ui/gfx/icon_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ui/base/cursor/cursor_loader_x11.cc ('k') | ui/gfx/icon_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698