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

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/DesktopView.java

Issue 2255663002: [Remoting Android] Use floating point coords for rendering the cursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
joedow 2016/08/17 17:08:15 I think you should just delete the non-OpenGl file
Yuwei 2016/08/17 17:42:45 Yes. I'm planning to delete them in a separate CL.
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; 5 package org.chromium.chromoting;
6 6
7 import android.graphics.Bitmap; 7 import android.graphics.Bitmap;
8 import android.graphics.Canvas; 8 import android.graphics.Canvas;
9 import android.graphics.Color; 9 import android.graphics.Color;
10 import android.graphics.Paint; 10 import android.graphics.Paint;
11 import android.graphics.Point; 11 import android.graphics.Point;
12 import android.graphics.PointF;
12 import android.os.Looper; 13 import android.os.Looper;
13 import android.os.SystemClock; 14 import android.os.SystemClock;
14 import android.view.SurfaceHolder; 15 import android.view.SurfaceHolder;
15 16
16 import org.chromium.base.Log; 17 import org.chromium.base.Log;
17 import org.chromium.chromoting.jni.Client; 18 import org.chromium.chromoting.jni.Client;
18 import org.chromium.chromoting.jni.Display; 19 import org.chromium.chromoting.jni.Display;
19 20
20 /** 21 /**
21 * The user interface for viewing and interacting with a specific remote host. 22 * The user interface for viewing and interacting with a specific remote host.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // destroying the Surface until it is unlocked. 126 // destroying the Surface until it is unlocked.
126 if (!mSurfaceCreated) { 127 if (!mSurfaceCreated) {
127 return; 128 return;
128 } 129 }
129 canvas = getHolder().lockCanvas(); 130 canvas = getHolder().lockCanvas();
130 if (canvas == null) { 131 if (canvas == null) {
131 return; 132 return;
132 } 133 }
133 canvas.setMatrix(mRenderData.transform); 134 canvas.setMatrix(mRenderData.transform);
134 drawCursor = mRenderData.drawCursor; 135 drawCursor = mRenderData.drawCursor;
135 cursorPosition = mRenderData.getCursorPosition(); 136 cursorPosition = mRenderData.getIntegerCursorPosition();
136 } 137 }
137 138
138 canvas.drawColor(Color.BLACK); 139 canvas.drawColor(Color.BLACK);
139 canvas.drawBitmap(image, 0, 0, new Paint()); 140 canvas.drawBitmap(image, 0, 0, new Paint());
140 141
141 float scaleFactor; 142 float scaleFactor;
142 synchronized (mRenderData) { 143 synchronized (mRenderData) {
143 scaleFactor = mRenderData.transform.mapRadius(1); 144 scaleFactor = mRenderData.transform.mapRadius(1);
144 } 145 }
145 mOnPaint.raise(new PaintEventParameter(cursorPosition, canvas, scaleFact or)); 146 mOnPaint.raise(new PaintEventParameter(cursorPosition, canvas, scaleFact or));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 * will not be blank if the user later switches back to our window. 218 * will not be blank if the user later switches back to our window.
218 */ 219 */
219 @Override 220 @Override
220 public void surfaceDestroyed(SurfaceHolder holder) { 221 public void surfaceDestroyed(SurfaceHolder holder) {
221 synchronized (mRenderData) { 222 synchronized (mRenderData) {
222 mSurfaceCreated = false; 223 mSurfaceCreated = false;
223 } 224 }
224 } 225 }
225 226
226 @Override 227 @Override
227 public void showInputFeedback(InputFeedbackType feedbackToShow, Point pos) { 228 public void showInputFeedback(InputFeedbackType feedbackToShow, PointF pos) {
228 float radius = getFeedbackRadius(feedbackToShow); 229 float radius = getFeedbackRadius(feedbackToShow);
229 if (radius <= 0.0f) { 230 if (radius <= 0.0f) {
230 return; 231 return;
231 } 232 }
232 FeedbackAnimator.startAnimation(this, pos, radius); 233 FeedbackAnimator.startAnimation(this, new Point((int) pos.x, (int) pos.y ), radius);
233 requestRepaint(); 234 requestRepaint();
234 } 235 }
235 236
236 @Override 237 @Override
237 public void transformationChanged() { 238 public void transformationChanged() {
238 requestRepaint(); 239 requestRepaint();
239 } 240 }
240 241
241 @Override 242 @Override
242 public void cursorMoved() { 243 public void cursorMoved() {
(...skipping 10 matching lines...) Expand all
253 @Override 254 @Override
254 public void setAnimationEnabled(boolean enabled) { 255 public void setAnimationEnabled(boolean enabled) {
255 synchronized (mAnimationLock) { 256 synchronized (mAnimationLock) {
256 if (enabled && !mInputAnimationRunning) { 257 if (enabled && !mInputAnimationRunning) {
257 requestRepaint(); 258 requestRepaint();
258 } 259 }
259 mInputAnimationRunning = enabled; 260 mInputAnimationRunning = enabled;
260 } 261 }
261 } 262 }
262 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698