summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/base/cursor/cursors_aura.cc6
-rw-r--r--ui/base/x/x11_util.cc4
2 files changed, 7 insertions, 3 deletions
diff --git a/ui/base/cursor/cursors_aura.cc b/ui/base/cursor/cursors_aura.cc
index 400e54c..17349a7 100644
--- a/ui/base/cursor/cursors_aura.cc
+++ b/ui/base/cursor/cursors_aura.cc
@@ -6,6 +6,7 @@
#include "grit/ui_resources.h"
#include "ui/base/cursor/cursor.h"
+#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/point.h"
namespace ui {
@@ -77,10 +78,13 @@ bool SearchTable(const CursorData* table,
float scale_factor,
int* resource_id,
gfx::Point* point) {
+ bool resource_2x_available =
+ ResourceBundle::GetSharedInstance().max_scale_factor() ==
+ SCALE_FACTOR_200P;
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 ?
+ *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);
return true;
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index 663a9eb..836feae 100644
--- a/ui/base/x/x11_util.cc
+++ b/ui/base/x/x11_util.cc
@@ -475,8 +475,8 @@ XcursorImage* SkBitmapToXcursorImage(const SkBitmap* cursor_image,
const SkBitmap* bitmap = needs_scale ? &scaled : cursor_image;
XcursorImage* image = XcursorImageCreate(bitmap->width(), bitmap->height());
- image->xhot = hotspot_point.x();
- image->yhot = hotspot_point.y();
+ image->xhot = std::min(bitmap->width() - 1, hotspot_point.x());
+ image->yhot = std::min(bitmap->height() - 1, hotspot_point.y());
if (bitmap->width() && bitmap->height()) {
bitmap->lockPixels();