Chromium Code Reviews| 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..494a42c95d8bc20b5d7d2e751f0ef7340b2e5b0c 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,26 @@ gfx::NativeCursor WebCursor::GetNativeCursor() { |
| } |
| } |
| +float WebCursor::GetCursorScaleFactor() { |
| + return device_scale_factor_ / custom_scale_; |
|
ananta
2015/12/15 23:28:17
do we need a dcheck for custom_scale_ == 0?
Bret
2015/12/16 19:03:59
Done.
|
| +} |
| + |
| +void WebCursor::CreateScaledBitmapAndHotspotFromCustomData( |
| + SkBitmap* bitmap, |
| + gfx::Point* hotspot) { |
| + *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); |
| +} |
| + |
| +void WebCursor::SetDisplayInfo(const gfx::Display& display) { |
| + if (device_scale_factor_ == display.device_scale_factor()) |
| + return; |
| + |
| + device_scale_factor_ = display.device_scale_factor(); |
| + CleanupPlatformData(); |
| +} |
| + |
| } // namespace content |