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

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

Issue 2175353003: [Remoting Android] Define feedback animation size in dp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set up radius inside AbstractDesktopView 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 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; 5 package org.chromium.chromoting;
6 6
7 import android.graphics.Point; 7 import android.graphics.Point;
8 import android.view.SurfaceHolder; 8 import android.view.SurfaceHolder;
9 9
10 import org.chromium.chromoting.jni.Client; 10 import org.chromium.chromoting.jni.Client;
(...skipping 11 matching lines...) Expand all
22 22
23 public GlDesktopView(GlDisplay display, Desktop desktop, Client client) { 23 public GlDesktopView(GlDisplay display, Desktop desktop, Client client) {
24 super(desktop, client); 24 super(desktop, client);
25 Preconditions.notNull(display); 25 Preconditions.notNull(display);
26 mDisplay = display; 26 mDisplay = display;
27 27
28 getHolder().addCallback(this); 28 getHolder().addCallback(this);
29 } 29 }
30 30
31 @Override 31 @Override
32 public void showInputFeedback(InputFeedbackType feedbackToShow, Point pos) { 32 public void showInputFeedback(float feedbackRadius, Point pos) {
33 float diameter; 33 // Note that the OpenGL renderer takes diameter as argument so the radiu s we got needs
34 // TODO(yuweih): diameter (and radius in DesktopView) should be defined in dp so that it is 34 // to be multiplied by 2.
joedow 2016/07/26 03:03:24 You could remove the comment and just add a var: f
Yuwei 2016/07/26 18:47:26 Done.
35 // DPI independent. 35
36 switch (feedbackToShow) {
37 case LARGE_ANIMATION:
38 diameter = 320.f;
39 break;
40 case SMALL_ANIMATION:
41 diameter = 80.f;
42 break;
43 default:
44 return;
45 }
46 float scaleFactor = mRenderData.transform.mapRadius(1); 36 float scaleFactor = mRenderData.transform.mapRadius(1);
47 mDisplay.showCursorInputFeedback(pos.x, pos.y, diameter / scaleFactor); 37 mDisplay.showCursorInputFeedback(pos.x, pos.y, 2 * feedbackRadius / scal eFactor);
48 } 38 }
49 39
50 @Override 40 @Override
51 public void transformationChanged() { 41 public void transformationChanged() {
52 if (mRenderData.imageHeight == 0 || mRenderData.imageWidth == 0 42 if (mRenderData.imageHeight == 0 || mRenderData.imageWidth == 0
53 || mRenderData.screenHeight == 0 || mRenderData.screenWidth == 0 ) { 43 || mRenderData.screenHeight == 0 || mRenderData.screenWidth == 0 ) {
54 return; 44 return;
55 } 45 }
56 float[] matrix = new float[9]; 46 float[] matrix = new float[9];
57 mRenderData.transform.getValues(matrix); 47 mRenderData.transform.getValues(matrix);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 @Override 108 @Override
119 public void surfaceDestroyed(SurfaceHolder holder) { 109 public void surfaceDestroyed(SurfaceHolder holder) {
120 // GlDisplay's life time spans to the whole session while GlDesktopView may be created and 110 // GlDisplay's life time spans to the whole session while GlDesktopView may be created and
121 // destroyed for multiple times (say when the phone is rotated). It is i mportant to remove 111 // destroyed for multiple times (say when the phone is rotated). It is i mportant to remove
122 // the listeners when the surface is about to be destroyed. 112 // the listeners when the surface is about to be destroyed.
123 mDisplay.onHostSizeChanged().remove(mOnHostSizeChangedListenerKey); 113 mDisplay.onHostSizeChanged().remove(mOnHostSizeChangedListenerKey);
124 mDisplay.onCanvasRendered().remove(mOnCanvasRenderedListenerKey); 114 mDisplay.onCanvasRendered().remove(mOnCanvasRenderedListenerKey);
125 mDisplay.surfaceDestroyed(); 115 mDisplay.surfaceDestroyed();
126 } 116 }
127 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698