OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.jni; | 5 package org.chromium.chromoting.jni; |
6 | 6 |
7 import android.view.Surface; | 7 import android.view.Surface; |
8 | 8 |
9 import org.chromium.base.annotations.CalledByNative; | 9 import org.chromium.base.annotations.CalledByNative; |
10 import org.chromium.base.annotations.JNINamespace; | 10 import org.chromium.base.annotations.JNINamespace; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 * Sets the transformation matrix (in pixel coordinates). | 79 * Sets the transformation matrix (in pixel coordinates). |
80 * @param matrix the transformation matrix | 80 * @param matrix the transformation matrix |
81 */ | 81 */ |
82 public void pixelTransformationChanged(float[] matrix) { | 82 public void pixelTransformationChanged(float[] matrix) { |
83 if (mNativeJniGlDisplay != 0) { | 83 if (mNativeJniGlDisplay != 0) { |
84 nativeOnPixelTransformationChanged(mNativeJniGlDisplay, matrix); | 84 nativeOnPixelTransformationChanged(mNativeJniGlDisplay, matrix); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 /** Moves the cursor to the corresponding location on the desktop. */ | 88 /** Moves the cursor to the corresponding location on the desktop. */ |
89 public void cursorPixelPositionChanged(int x, int y) { | 89 public void cursorPixelPositionChanged(float x, float y) { |
90 if (mNativeJniGlDisplay != 0) { | 90 if (mNativeJniGlDisplay != 0) { |
91 nativeOnCursorPixelPositionChanged(mNativeJniGlDisplay, x, y); | 91 nativeOnCursorPixelPositionChanged(mNativeJniGlDisplay, x, y); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 /** | 95 /** |
96 * Decides whether the cursor should be shown on the canvas. | 96 * Decides whether the cursor should be shown on the canvas. |
97 */ | 97 */ |
98 public void cursorVisibilityChanged(boolean visible) { | 98 public void cursorVisibilityChanged(boolean visible) { |
99 if (mNativeJniGlDisplay != 0) { | 99 if (mNativeJniGlDisplay != 0) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 * by the OpenGL renderer. | 133 * by the OpenGL renderer. |
134 */ | 134 */ |
135 public Event<Void> onCanvasRendered() { | 135 public Event<Void> onCanvasRendered() { |
136 return mOnCanvasRendered; | 136 return mOnCanvasRendered; |
137 } | 137 } |
138 | 138 |
139 /** | 139 /** |
140 * Shows the cursor input feedback animation with the given diameter at the
given desktop | 140 * Shows the cursor input feedback animation with the given diameter at the
given desktop |
141 * location. | 141 * location. |
142 */ | 142 */ |
143 public void showCursorInputFeedback(int x, int y, float diameter) { | 143 public void showCursorInputFeedback(float x, float y, float diameter) { |
144 if (mNativeJniGlDisplay != 0) { | 144 if (mNativeJniGlDisplay != 0) { |
145 nativeOnCursorInputFeedback(mNativeJniGlDisplay, x, y, diameter); | 145 nativeOnCursorInputFeedback(mNativeJniGlDisplay, x, y, diameter); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 @CalledByNative | 149 @CalledByNative |
150 private void initializeClient(Client client) { | 150 private void initializeClient(Client client) { |
151 client.setDesktopViewFactory(new DesktopViewFactory() { | 151 client.setDesktopViewFactory(new DesktopViewFactory() { |
152 @Override | 152 @Override |
153 public AbstractDesktopView createDesktopView(Desktop desktop, Client
client) { | 153 public AbstractDesktopView createDesktopView(Desktop desktop, Client
client) { |
154 return new GlDesktopView(GlDisplay.this, desktop, client); | 154 return new GlDesktopView(GlDisplay.this, desktop, client); |
155 } | 155 } |
156 }); | 156 }); |
157 } | 157 } |
158 | 158 |
159 @CalledByNative | 159 @CalledByNative |
160 private static GlDisplay createJavaDisplayObject(long nativeDisplayHandler)
{ | 160 private static GlDisplay createJavaDisplayObject(long nativeDisplayHandler)
{ |
161 return new GlDisplay(nativeDisplayHandler); | 161 return new GlDisplay(nativeDisplayHandler); |
162 } | 162 } |
163 | 163 |
164 private native void nativeOnSurfaceCreated(long nativeJniGlDisplayHandler, S
urface surface); | 164 private native void nativeOnSurfaceCreated(long nativeJniGlDisplayHandler, S
urface surface); |
165 private native void nativeOnSurfaceChanged(long nativeJniGlDisplayHandler, | 165 private native void nativeOnSurfaceChanged(long nativeJniGlDisplayHandler, |
166 int width, int height); | 166 int width, int height); |
167 private native void nativeOnSurfaceDestroyed(long nativeJniGlDisplayHandler)
; | 167 private native void nativeOnSurfaceDestroyed(long nativeJniGlDisplayHandler)
; |
168 private native void nativeOnPixelTransformationChanged(long nativeJniGlDispl
ayHandler, | 168 private native void nativeOnPixelTransformationChanged(long nativeJniGlDispl
ayHandler, |
169 float[] matrix); | 169 float[] matrix); |
170 private native void nativeOnCursorPixelPositionChanged(long nativeJniGlDispl
ayHandler, | 170 private native void nativeOnCursorPixelPositionChanged(long nativeJniGlDispl
ayHandler, |
171 int x, int y); | 171 float x, float y); |
172 private native void nativeOnCursorInputFeedback(long nativeJniGlDisplayHandl
er, | 172 private native void nativeOnCursorInputFeedback(long nativeJniGlDisplayHandl
er, |
173 int x, int y, float diameter
); | 173 float x, float y, float diam
eter); |
174 private native void nativeOnCursorVisibilityChanged(long nativeJniGlDisplayH
andler, | 174 private native void nativeOnCursorVisibilityChanged(long nativeJniGlDisplayH
andler, |
175 boolean visible); | 175 boolean visible); |
176 } | 176 } |
OLD | NEW |