Index: remoting/client/plugin/pepper_view.cc |
diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc |
index 6b67eacf77cf674332e270353e812ee77e032fbb..7b118be5bef3fb1857cb7f2d71def593a8b36e22 100644 |
--- a/remoting/client/plugin/pepper_view.cc |
+++ b/remoting/client/plugin/pepper_view.cc |
@@ -12,6 +12,7 @@ |
#include "ppapi/cpp/completion_callback.h" |
#include "ppapi/cpp/graphics_2d.h" |
#include "ppapi/cpp/image_data.h" |
+#include "ppapi/cpp/mouse_cursor.h" |
#include "ppapi/cpp/point.h" |
#include "ppapi/cpp/rect.h" |
#include "ppapi/cpp/size.h" |
@@ -149,6 +150,31 @@ protocol::ClipboardStub* PepperView::GetClipboardStub() { |
return instance_; |
} |
+void PepperView::SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) { |
+ if (!cursor_shape.has_data()) |
+ return; |
+ |
+ int width = cursor_shape.width(); |
Wez
2012/05/23 00:01:57
This and the other fields you use below are option
garykac
2012/05/26 01:58:01
Done.
|
+ int height = cursor_shape.height(); |
+ int hotspot_x = cursor_shape.hotspot_x(); |
+ int hotspot_y = cursor_shape.hotspot_y(); |
+ |
+ pp::ImageData* cursor_image; |
+ cursor_image = new pp::ImageData(instance_, |
+ PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
+ pp::Size(width, height), |
+ false); |
Wez
2012/05/23 00:01:57
You're leaking the C++ wrapper for the ImageData r
garykac
2012/05/26 01:58:01
Done.
|
+ |
+ int total_bytes = width * height * 4; |
+ memcpy(cursor_image->data(), cursor_shape.data().data(), total_bytes); |
Wez
2012/05/23 00:01:57
Are we guaranteed that the stride of the ImageData
garykac
2012/05/26 01:58:01
Done.
|
+ |
+ // TODO(garykac) Use pp::ImageData::GetNativeImageDataFormat() and |
+ // constrain to 32x32 pixels. |
Wez
2012/05/23 00:01:57
nit: Clarify that this is because the SetCursor()
garykac
2012/05/26 01:58:01
Done.
|
+ pp::MouseCursor::SetCursor(instance_, PP_MOUSECURSOR_TYPE_CUSTOM, |
+ *cursor_image, |
+ pp::Point(hotspot_x, hotspot_y)); |
+} |
+ |
void PepperView::SetView(const SkISize& view_size, const SkIRect& clip_area) { |
bool view_changed = false; |