summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webcursor_gtk.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-12 00:55:14 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-12 00:55:14 +0000
commit7e8a83c5f13b6ed0c5be202f5697efc07cee06ce (patch)
tree30e2706419a6d2d035783a326be71fa296a27dae /webkit/glue/webcursor_gtk.cc
parente47aec55e850707ca01222868e9a19221e3f6a05 (diff)
downloadchromium_src-7e8a83c5f13b6ed0c5be202f5697efc07cee06ce.zip
chromium_src-7e8a83c5f13b6ed0c5be202f5697efc07cee06ce.tar.gz
chromium_src-7e8a83c5f13b6ed0c5be202f5697efc07cee06ce.tar.bz2
GTK: fix decoding of custom cursor bytes.
The bytes of an SkBitmap are not directly translatable into those of a GdkPixbuf. Use the utility function we already have for converting between the pixel data of these two types. BUG=51816 TEST=see bug Review URL: http://codereview.chromium.org/3130008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webcursor_gtk.cc')
-rw-r--r--webkit/glue/webcursor_gtk.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/webkit/glue/webcursor_gtk.cc b/webkit/glue/webcursor_gtk.cc
index 70c0f46..54c8837 100644
--- a/webkit/glue/webcursor_gtk.cc
+++ b/webkit/glue/webcursor_gtk.cc
@@ -8,6 +8,7 @@
#include <gtk/gtk.h>
#include "base/logging.h"
+#include "gfx/gtk_util.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h"
using WebKit::WebCursorInfo;
@@ -171,18 +172,13 @@ GdkCursor* WebCursor::GetCustomCursor() const {
return NULL;
}
- const guchar* data = reinterpret_cast<const guchar*>(&custom_data_[0]);
- GdkPixbuf* pixbuf =
- gdk_pixbuf_new_from_data(data,
- GDK_COLORSPACE_RGB,
- TRUE, // has_alpha
- 8, // bits_per_sample
- custom_size_.width(), // width
- custom_size_.height(), // height
- custom_size_.width() * 4, // row stride
- NULL, // data destroy function
- NULL); // data destroy function extra data
+ 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());
+ GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap);
GdkCursor* cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(),
pixbuf,
hotspot_.x(),