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

Unified Diff: ui/base/cursor/cursors_aura.cc

Issue 2605773002: Fix Aura can't provide accurate cursor hotspot info. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/cursor/cursors_aura.cc
diff --git a/ui/base/cursor/cursors_aura.cc b/ui/base/cursor/cursors_aura.cc
index a69517f37de408729ad3ca9537b7fe46c021883c..19702a51182839dbdd99a69fa85d768b4be037f7 100644
--- a/ui/base/cursor/cursors_aura.cc
+++ b/ui/base/cursor/cursors_aura.cc
@@ -175,9 +175,9 @@ bool SearchTable(const CursorData* table,
for (size_t i = 0; i < table_length; ++i) {
if (table[i].id == id) {
*resource_id = table[i].resource_id;
- *point = scale_factor == 1.0f || !resource_2x_available ?
- gfx::Point(table[i].hot_1x.x, table[i].hot_1x.y) :
- gfx::Point(table[i].hot_2x.x, table[i].hot_2x.y);
+ *point = scale_factor != 2.0f || !resource_2x_available
+ ? gfx::Point(table[i].hot_1x.x, table[i].hot_1x.y)
+ : gfx::Point(table[i].hot_2x.x, table[i].hot_2x.y);
sadrul 2017/01/03 17:18:09 Why change this?
braveyao 2017/01/03 17:30:51 To make the 1x as the default, which I suppose cou
sadrul 2017/01/04 16:16:24 I think we prefer the 2x versions for other image
braveyao 2017/01/04 17:37:36 Done.
return true;
}
}
@@ -239,6 +239,7 @@ bool GetCursorBitmap(const Cursor& cursor,
cursor_loader.SetPlatformCursor(&cursor_copy);
const std::unique_ptr<SkBitmap> cursor_bitmap(
IconUtil::CreateSkBitmapFromHICON(cursor_copy.platform()));
+ *point = IconUtil::GetHotSpotFromHICON(cursor_copy.platform());
#else
int resource_id;
if (!GetCursorDataFor(ui::CURSOR_SET_NORMAL,
« no previous file with comments | « ui/base/cursor/cursor_loader_x11.cc ('k') | ui/gfx/icon_util.h » ('j') | ui/gfx/icon_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698