summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-04 18:25:39 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-04 18:25:39 +0000
commitb54987703b0a5f7b1dcc192ae7e1e124cabe2da9 (patch)
treee7b23a116e9dad7fcb55c491d9c3a4f80789dcf3 /webkit/glue
parentb2c1359a216039e87c6b1b0d322576b30faa7019 (diff)
downloadchromium_src-b54987703b0a5f7b1dcc192ae7e1e124cabe2da9.zip
chromium_src-b54987703b0a5f7b1dcc192ae7e1e124cabe2da9.tar.gz
chromium_src-b54987703b0a5f7b1dcc192ae7e1e124cabe2da9.tar.bz2
Aura: Adds custom cursors for drag and drop.
BUG=121135 TEST=none Review URL: https://chromiumcodereview.appspot.com/10316019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/webcursor_aurax11.cc35
1 files changed, 6 insertions, 29 deletions
diff --git a/webkit/glue/webcursor_aurax11.cc b/webkit/glue/webcursor_aurax11.cc
index fe221e2..b3f6989 100644
--- a/webkit/glue/webcursor_aurax11.cc
+++ b/webkit/glue/webcursor_aurax11.cc
@@ -10,7 +10,6 @@
#include "base/logging.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
-#include "third_party/skia/include/core/SkUnPreMultiply.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/x/x11_util.h"
@@ -18,35 +17,13 @@ const ui::PlatformCursor WebCursor::GetPlatformCursor() {
if (platform_cursor_)
return platform_cursor_;
- XcursorImage* image =
- XcursorImageCreate(custom_size_.width(), custom_size_.height());
- image->xhot = hotspot_.x();
- image->yhot = hotspot_.y();
- uint32* pixels = image->pixels;
-
- if (custom_size_.width() && custom_size_.height()) {
- SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config,
- custom_size_.width(), custom_size_.height());
- bitmap.allocPixels();
- memcpy(bitmap.getAddr32(0, 0), custom_data_.data(), custom_data_.size());
-
- bitmap.lockPixels();
- int height = bitmap.height(), width = bitmap.width();
- for (int y = 0, i = 0; y < height; y++) {
- for (int x = 0; x < width; x++) {
- uint32 pixel = bitmap.getAddr32(0, y)[x];
- int alpha = SkColorGetA(pixel);
- if (alpha != 0 && alpha != 255)
- pixels[i] = SkUnPreMultiply::PMColorToColor(pixel);
- else
- pixels[i] = pixel;
- ++i;
- }
- }
- bitmap.unlockPixels();
- }
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config,
+ custom_size_.width(), custom_size_.height());
+ bitmap.allocPixels();
+ memcpy(bitmap.getAddr32(0, 0), custom_data_.data(), custom_data_.size());
+ XcursorImage* image = ui::SkBitmapToXcursorImage(&bitmap, hotspot_);
platform_cursor_ = ui::CreateReffedCustomXCursor(image);
return platform_cursor_;
}