summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 05:55:07 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 05:55:07 +0000
commit0724e82343ab19fca8afe92c57f0bd78df1fa567 (patch)
treee6ddfc1207ede93faf6c8991071ae8b93944a05f /webkit/glue
parent47b375e2cabf0d953a4a342e7c51abc9a5afc926 (diff)
downloadchromium_src-0724e82343ab19fca8afe92c57f0bd78df1fa567.zip
chromium_src-0724e82343ab19fca8afe92c57f0bd78df1fa567.tar.gz
chromium_src-0724e82343ab19fca8afe92c57f0bd78df1fa567.tar.bz2
Revert r135533.
It broke all content_unittests on mac in debug builds. BUG=121135,126558 TEST=no stack dumps in content_unittests output on mac debug builds TBR=varunjain Review URL: https://chromiumcodereview.appspot.com/10386020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/webcursor_aurax11.cc35
1 files changed, 29 insertions, 6 deletions
diff --git a/webkit/glue/webcursor_aurax11.cc b/webkit/glue/webcursor_aurax11.cc
index b3f6989..fe221e2 100644
--- a/webkit/glue/webcursor_aurax11.cc
+++ b/webkit/glue/webcursor_aurax11.cc
@@ -10,6 +10,7 @@
#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"
@@ -17,13 +18,35 @@ const ui::PlatformCursor WebCursor::GetPlatformCursor() {
if (platform_cursor_)
return platform_cursor_;
- 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 =
+ 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();
+ }
- XcursorImage* image = ui::SkBitmapToXcursorImage(&bitmap, hotspot_);
platform_cursor_ = ui::CreateReffedCustomXCursor(image);
return platform_cursor_;
}