Chromium Code Reviews| Index: remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java |
| diff --git a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java |
| index 4508e58786b83612b510ae15dfb0403986ab1d01..673dbb2872b493092bd5bf8897cffa51ae3b29fc 100644 |
| --- a/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java |
| +++ b/remoting/android/java/src/org/chromium/chromoting/jni/JniInterface.java |
| @@ -11,6 +11,7 @@ import android.content.Context; |
| import android.content.DialogInterface; |
| import android.content.SharedPreferences; |
| import android.graphics.Bitmap; |
| +import android.graphics.Point; |
| import android.os.Looper; |
| import android.text.InputType; |
| import android.util.Log; |
| @@ -123,6 +124,12 @@ public class JniInterface { |
| /** Performs the native portion of the cleanup. */ |
| private static native void disconnectNative(); |
| + /** Position of cursor hotspot within cursor image. */ |
| + public static Point getCursorHotspot() { return sCursorHotspot; } |
| + |
| + /** Returns the current cursor shape. */ |
| + public static Bitmap getCursorBitmap() { return sCursorBitmap; } |
| + |
| /* |
| * Entry points *from* the native code. |
| */ |
| @@ -138,6 +145,12 @@ public class JniInterface { |
| /** Buffer holding the video feed. */ |
| private static ByteBuffer sBuffer = null; |
| + /** Position of cursor hot-spot. */ |
| + private static Point sCursorHotspot = new Point(); |
| + |
| + /** Bitmap holding the cursor shape. */ |
| + private static Bitmap sCursorBitmap = null; |
| + |
| /** Reports whenever the connection status changes. */ |
| private static void reportConnectionStatus(int state, int error) { |
| if (state < SUCCESSFUL_CONNECTION && error == 0) { |
| @@ -305,6 +318,21 @@ public class JniInterface { |
| return Bitmap.createBitmap(frame, 0, sWidth, sWidth, sHeight, Bitmap.Config.ARGB_8888); |
| } |
| + /** |
| + * Updates the cursor shape. This is called from native code on the graphics thread when |
| + * receiving a new cursor shape from the host. |
| + */ |
| + public static void updateCursorShape(int width, int height, int hotspotX, int hotspotY, |
| + ByteBuffer buffer) { |
| + sCursorHotspot.x = hotspotX; |
|
Sergey Ulanov
2013/09/14 02:21:29
it's better to create a new Point instance here in
solb
2013/09/14 03:44:42
I think Sergey brings up a good point here.
Lambros
2013/09/16 21:52:58
Done.
|
| + sCursorHotspot.y = hotspotY; |
| + |
| + int[] data = new int[width * height]; |
| + buffer.order(ByteOrder.LITTLE_ENDIAN); |
| + buffer.asIntBuffer().get(data, 0, data.length); |
| + sCursorBitmap = Bitmap.createBitmap(data, width, height, Bitmap.Config.ARGB_8888); |
| + } |
| + |
| /** Moves the mouse cursor, possibly while clicking the specified (nonnegative) button. */ |
| public static void mouseAction(int x, int y, int whichButton, boolean buttonDown) { |
| if (!sConnected) { |