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

Unified Diff: content/common/cursors/webcursor_aura.cc

Issue 1525263004: hidpi support for custom cursors in windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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: 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

Powered by Google App Engine
This is Rietveld 408576698