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

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: Created 4 years, 5 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 13 matching lines...) Expand all
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(InputFeedbackType feedbackToShow, Point pos) {
33 float diameter; 33 float diameter;
34 // TODO(yuweih): diameter (and radius in DesktopView) should be defined in dp so that it is
35 // DPI independent.
36 switch (feedbackToShow) { 34 switch (feedbackToShow) {
35 case SMALL_ANIMATION:
36 diameter = 2 * getResources()
37 .getDimensionPixelSize(R.dimen.feedback_animation_radius _small);
joedow 2016/07/25 20:24:18 Why 2 * size? Same comment about caching as the o
Yuwei 2016/07/25 20:57:13 That's because the OpenGL implementation takes dia
Yuwei 2016/07/25 21:21:56 Done. Added comment.
38 break;
39
37 case LARGE_ANIMATION: 40 case LARGE_ANIMATION:
38 diameter = 320.f; 41 diameter = 2 * getResources()
42 .getDimensionPixelSize(R.dimen.feedback_animation_radius _large);
39 break; 43 break;
40 case SMALL_ANIMATION: 44
41 diameter = 80.f;
42 break;
43 default: 45 default:
46 assert false : "Unreached";
44 return; 47 return;
45 } 48 }
46 float scaleFactor = mRenderData.transform.mapRadius(1); 49 float scaleFactor = mRenderData.transform.mapRadius(1);
47 mDisplay.showCursorInputFeedback(pos.x, pos.y, diameter / scaleFactor); 50 mDisplay.showCursorInputFeedback(pos.x, pos.y, diameter / scaleFactor);
48 } 51 }
49 52
50 @Override 53 @Override
51 public void transformationChanged() { 54 public void transformationChanged() {
52 if (mRenderData.imageHeight == 0 || mRenderData.imageWidth == 0 55 if (mRenderData.imageHeight == 0 || mRenderData.imageWidth == 0
53 || mRenderData.screenHeight == 0 || mRenderData.screenWidth == 0 ) { 56 || mRenderData.screenHeight == 0 || mRenderData.screenWidth == 0 ) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 @Override 121 @Override
119 public void surfaceDestroyed(SurfaceHolder holder) { 122 public void surfaceDestroyed(SurfaceHolder holder) {
120 // GlDisplay's life time spans to the whole session while GlDesktopView may be created and 123 // 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 124 // 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. 125 // the listeners when the surface is about to be destroyed.
123 mDisplay.onHostSizeChanged().remove(mOnHostSizeChangedListenerKey); 126 mDisplay.onHostSizeChanged().remove(mOnHostSizeChangedListenerKey);
124 mDisplay.onCanvasRendered().remove(mOnCanvasRenderedListenerKey); 127 mDisplay.onCanvasRendered().remove(mOnCanvasRenderedListenerKey);
125 mDisplay.surfaceDestroyed(); 128 mDisplay.surfaceDestroyed();
126 } 129 }
127 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698