Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: remoting/client/plugin/pepper_view.cc

Issue 10382184: [Chromoting] Initial plumbing for cursor shape. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extra LOGs Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698