| Index: webkit/glue/webcursor_aurax11.cc
|
| diff --git a/webkit/glue/webcursor_aurax11.cc b/webkit/glue/webcursor_aurax11.cc
|
| index b3f698900688279d109a280aaeb58f4c3f235a95..98f8d0611e256d84d2add9b9882ee12729fa07f7 100644
|
| --- a/webkit/glue/webcursor_aurax11.cc
|
| +++ b/webkit/glue/webcursor_aurax11.cc
|
| @@ -9,6 +9,7 @@
|
| #include <X11/cursorfont.h>
|
|
|
| #include "base/logging.h"
|
| +#include "skia/ext/image_operations.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
|
| #include "ui/base/cursor/cursor.h"
|
| #include "ui/base/x/x11_util.h"
|
| @@ -23,13 +24,37 @@ const ui::PlatformCursor WebCursor::GetPlatformCursor() {
|
| bitmap.allocPixels();
|
| memcpy(bitmap.getAddr32(0, 0), custom_data_.data(), custom_data_.size());
|
|
|
| - XcursorImage* image = ui::SkBitmapToXcursorImage(&bitmap, hotspot_);
|
| + XcursorImage* image = NULL;
|
| + if (scale_factor_ == 1.f) {
|
| + image = ui::SkBitmapToXcursorImage(&bitmap, hotspot_);
|
| + } else {
|
| + gfx::Size scaled_size = custom_size_.Scale(scale_factor_);
|
| + SkBitmap scaled_bitmap = skia::ImageOperations::Resize(bitmap,
|
| + skia::ImageOperations::RESIZE_BETTER,
|
| + scaled_size.width(),
|
| + scaled_size.height());
|
| + image = ui::SkBitmapToXcursorImage(&scaled_bitmap,
|
| + hotspot_.Scale(scale_factor_));
|
| + }
|
| platform_cursor_ = ui::CreateReffedCustomXCursor(image);
|
| return platform_cursor_;
|
| }
|
|
|
| +void WebCursor::SetScaleFactor(float scale_factor) {
|
| + if (scale_factor_ == scale_factor)
|
| + return;
|
| +
|
| + scale_factor_ = scale_factor;
|
| + if (platform_cursor_)
|
| + ui::UnrefCustomXCursor(platform_cursor_);
|
| + platform_cursor_ = 0;
|
| + // It is not necessary to recreate platform_cursor_ yet, since it will be
|
| + // recreated on demand when GetPlatformCursor is called.
|
| +}
|
| +
|
| void WebCursor::InitPlatformData() {
|
| platform_cursor_ = 0;
|
| + scale_factor_ = 1.f;
|
| }
|
|
|
| bool WebCursor::SerializePlatformData(Pickle* pickle) const {
|
| @@ -57,4 +82,6 @@ void WebCursor::CopyPlatformData(const WebCursor& other) {
|
| platform_cursor_ = other.platform_cursor_;
|
| if (platform_cursor_)
|
| ui::RefCustomXCursor(platform_cursor_);
|
| +
|
| + scale_factor_ = other.scale_factor_;
|
| }
|
|
|