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; | 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 Loading... |
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. |
34 switch (feedbackToShow) { | 36 switch (feedbackToShow) { |
35 case LARGE_ANIMATION: | 37 case LARGE_ANIMATION: |
36 diameter = 320.f; | 38 diameter = 320.f; |
37 break; | 39 break; |
38 case SMALL_ANIMATION: | 40 case SMALL_ANIMATION: |
39 diameter = 80.f; | 41 diameter = 80.f; |
40 break; | 42 break; |
41 default: | 43 default: |
42 return; | 44 return; |
43 } | 45 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 @Override | 118 @Override |
117 public void surfaceDestroyed(SurfaceHolder holder) { | 119 public void surfaceDestroyed(SurfaceHolder holder) { |
118 // GlDisplay's life time spans to the whole session while GlDesktopView
may be created and | 120 // GlDisplay's life time spans to the whole session while GlDesktopView
may be created and |
119 // destroyed for multiple times (say when the phone is rotated). It is i
mportant to remove | 121 // destroyed for multiple times (say when the phone is rotated). It is i
mportant to remove |
120 // the listeners when the surface is about to be destroyed. | 122 // the listeners when the surface is about to be destroyed. |
121 mDisplay.onHostSizeChanged().remove(mOnHostSizeChangedListenerKey); | 123 mDisplay.onHostSizeChanged().remove(mOnHostSizeChangedListenerKey); |
122 mDisplay.onCanvasRendered().remove(mOnCanvasRenderedListenerKey); | 124 mDisplay.onCanvasRendered().remove(mOnCanvasRenderedListenerKey); |
123 mDisplay.surfaceDestroyed(); | 125 mDisplay.surfaceDestroyed(); |
124 } | 126 } |
125 } | 127 } |
OLD | NEW |