| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chromoting.cardboard; | 5 package org.chromium.chromoting.cardboard; |
| 6 | 6 |
| 7 import static org.chromium.chromoting.cardboard.CardboardUtil.makeFloatBuffer; | 7 import static org.chromium.chromoting.cardboard.CardboardUtil.makeFloatBuffer; |
| 8 import static org.chromium.chromoting.cardboard.CardboardUtil.makeRectangularTex
tureBuffer; | 8 import static org.chromium.chromoting.cardboard.CardboardUtil.makeRectangularTex
tureBuffer; |
| 9 | 9 |
| 10 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
| 11 import android.graphics.Point; | 11 import android.graphics.Point; |
| 12 import android.graphics.PointF; | 12 import android.graphics.PointF; |
| 13 import android.opengl.GLES20; | 13 import android.opengl.GLES20; |
| 14 | 14 |
| 15 import org.chromium.chromoting.TouchInputHandler; | 15 import org.chromium.chromoting.InputStub; |
| 16 import org.chromium.chromoting.jni.Client; | 16 import org.chromium.chromoting.jni.Client; |
| 17 | 17 |
| 18 import java.nio.FloatBuffer; | 18 import java.nio.FloatBuffer; |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Cardboard activity desktop cursor that is used to render the image of the mou
se | 21 * Cardboard activity desktop cursor that is used to render the image of the mou
se |
| 22 * cursor onto the desktop. | 22 * cursor onto the desktop. |
| 23 */ | 23 */ |
| 24 public class Cursor { | 24 public class Cursor { |
| 25 private static final String VERTEX_SHADER = | 25 private static final String VERTEX_SHADER = |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return Math.abs(mCursorPosition.x - position.x) > CURSOR_MOVE_THRESHOLD | 117 return Math.abs(mCursorPosition.x - position.x) > CURSOR_MOVE_THRESHOLD |
| 118 || Math.abs(mCursorPosition.y - position.y) > CURSOR_MOVE_THRESH
OLD; | 118 || Math.abs(mCursorPosition.y - position.y) > CURSOR_MOVE_THRESH
OLD; |
| 119 } | 119 } |
| 120 | 120 |
| 121 /** | 121 /** |
| 122 * Send the mouse move event to host when {@link moveCursor} returns true. | 122 * Send the mouse move event to host when {@link moveCursor} returns true. |
| 123 */ | 123 */ |
| 124 public void moveTo(PointF position) { | 124 public void moveTo(PointF position) { |
| 125 if (moveCursor(position)) { | 125 if (moveCursor(position)) { |
| 126 mClient.sendMouseEvent((int) position.x, (int) position.y, | 126 mClient.sendMouseEvent((int) position.x, (int) position.y, |
| 127 TouchInputHandler.BUTTON_UNDEFINED, false); | 127 InputStub.BUTTON_UNDEFINED, false); |
| 128 } | 128 } |
| 129 mCursorPosition = position; | 129 mCursorPosition = position; |
| 130 } | 130 } |
| 131 | 131 |
| 132 /** | 132 /** |
| 133 * Link the texture data for cursor if {@link mReloadTexture} is true. | 133 * Link the texture data for cursor if {@link mReloadTexture} is true. |
| 134 * Invoked from {@link com.google.vrtoolkit.cardboard.CardboardView.StereoRe
nderer.onNewFrame} | 134 * Invoked from {@link com.google.vrtoolkit.cardboard.CardboardView.StereoRe
nderer.onNewFrame} |
| 135 */ | 135 */ |
| 136 public void maybeLoadTexture(Desktop desktop) { | 136 public void maybeLoadTexture(Desktop desktop) { |
| 137 synchronized (mReloadTextureLock) { | 137 synchronized (mReloadTextureLock) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 /* | 237 /* |
| 238 * Clean cursor related opengl data. | 238 * Clean cursor related opengl data. |
| 239 */ | 239 */ |
| 240 public void cleanup() { | 240 public void cleanup() { |
| 241 GLES20.glDeleteShader(mVertexShaderHandle); | 241 GLES20.glDeleteShader(mVertexShaderHandle); |
| 242 GLES20.glDeleteShader(mFragmentShaderHandle); | 242 GLES20.glDeleteShader(mFragmentShaderHandle); |
| 243 GLES20.glDeleteTextures(1, new int[] {mTextureDataHandle}, 0); | 243 GLES20.glDeleteTextures(1, new int[] {mTextureDataHandle}, 0); |
| 244 } | 244 } |
| 245 } | 245 } |
| OLD | NEW |