Index: content/common/cursors/webcursor_aura.cc |
diff --git a/content/common/cursors/webcursor_aura.cc b/content/common/cursors/webcursor_aura.cc |
index 584ebdfb600f26b2b030284eb189a7648a2a71be..34868704001a86759e50ea6fd1ded0b174eeb2cb 100644 |
--- a/content/common/cursors/webcursor_aura.cc |
+++ b/content/common/cursors/webcursor_aura.cc |
@@ -7,6 +7,7 @@ |
#include "base/logging.h" |
#include "third_party/WebKit/public/platform/WebCursorInfo.h" |
#include "ui/base/cursor/cursor.h" |
+#include "ui/base/cursor/cursor_util.h" |
using blink::WebCursorInfo; |
@@ -111,4 +112,31 @@ gfx::NativeCursor WebCursor::GetNativeCursor() { |
} |
} |
+float WebCursor::GetCursorScaleFactor() { |
+ DCHECK(custom_scale_ != 0); |
+ return device_scale_factor_ / custom_scale_; |
+} |
+ |
+void WebCursor::CreateScaledBitmapAndHotspotFromCustomData( |
+ SkBitmap* bitmap, |
+ gfx::Point* hotspot) { |
+ DCHECK(custom_data_.size() > 0); |
+ *hotspot = hotspot_; |
+ bitmap->allocN32Pixels(custom_size_.width(), custom_size_.height()); |
+ memcpy(bitmap->getAddr32(0, 0), custom_data_.data(), custom_data_.size()); |
+ ui::ScaleAndRotateCursorBitmapAndHotpoint( |
+ GetCursorScaleFactor(), gfx::Display::ROTATE_0, bitmap, hotspot); |
+} |
+ |
+// ozone has its own SetDisplayInfo that takes rotation into account |
+#if !defined(USE_OZONE) |
+void WebCursor::SetDisplayInfo(const gfx::Display& display) { |
+ if (device_scale_factor_ == display.device_scale_factor()) |
+ return; |
+ |
+ device_scale_factor_ = display.device_scale_factor(); |
+ CleanupPlatformData(); |
+} |
+#endif |
+ |
} // namespace content |