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

Unified Diff: content/common/cursors/webcursor.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.cc
diff --git a/content/common/cursors/webcursor.cc b/content/common/cursors/webcursor.cc
index d610ceb45d36a817a8e74b1320a96c92c23ecb52..57c0e392038cf5412c3e2afec1d79ccf37b5027d 100644
--- a/content/common/cursors/webcursor.cc
+++ b/content/common/cursors/webcursor.cc
@@ -20,16 +20,10 @@ WebCursor::WebCursor()
#if defined(OS_WIN)
external_cursor_ = NULL;
#endif
- InitPlatformData();
-}
-
-WebCursor::WebCursor(const CursorInfo& cursor_info)
- : type_(WebCursorInfo::TypePointer) {
-#if defined(OS_WIN)
- external_cursor_ = NULL;
+#if defined(USE_AURA)
+ device_scale_factor_ = 1.0f;
#endif
InitPlatformData();
- InitFromCursorInfo(cursor_info);
}
WebCursor::~WebCursor() {
@@ -231,18 +225,24 @@ void WebCursor::Copy(const WebCursor& other) {
}
void WebCursor::SetCustomData(const SkBitmap& bitmap) {
+ CreateCustomData(bitmap, &custom_data_, &custom_size_);
+}
+
+void WebCursor::CreateCustomData(const SkBitmap& bitmap,
+ std::vector<char>* custom_data,
+ gfx::Size* custom_size) {
if (bitmap.empty())
return;
- // Fill custom_data_ directly with the NativeImage pixels.
- custom_data_.resize(bitmap.getSize());
- if (!custom_data_.empty()) {
+ // Fill custom_data directly with the NativeImage pixels.
+ custom_data->resize(bitmap.getSize());
+ if (!custom_data->empty()) {
//This will divide color values by alpha (un-premultiply) if necessary
SkImageInfo dstInfo = bitmap.info().makeAlphaType(kUnpremul_SkAlphaType);
- bitmap.readPixels(dstInfo, &custom_data_[0], dstInfo.minRowBytes(), 0, 0);
+ bitmap.readPixels(dstInfo, &(*custom_data)[0], dstInfo.minRowBytes(), 0, 0);
}
- custom_size_.set_width(bitmap.width());
- custom_size_.set_height(bitmap.height());
+ custom_size->set_width(bitmap.width());
+ custom_size->set_height(bitmap.height());
}
void WebCursor::ImageFromCustomData(SkBitmap* image) const {

Powered by Google App Engine
This is Rietveld 408576698