Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Canvas; | 9 import android.graphics.Canvas; |
| 10 import android.graphics.Color; | 10 import android.graphics.Color; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 Bitmap cursorBitmap = mClient.getDisplay().getCursorBitmap(); | 194 Bitmap cursorBitmap = mClient.getDisplay().getCursorBitmap(); |
| 195 if (cursorBitmap != null) { | 195 if (cursorBitmap != null) { |
| 196 Point hotspot = mClient.getDisplay().getCursorHotspot(); | 196 Point hotspot = mClient.getDisplay().getCursorHotspot(); |
| 197 canvas.drawBitmap(cursorBitmap, cursorPosition.x - hotspot.x, | 197 canvas.drawBitmap(cursorBitmap, cursorPosition.x - hotspot.x, |
| 198 cursorPosition.y - hotspot.y, new Paint()); | 198 cursorPosition.y - hotspot.y, new Paint()); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 getHolder().unlockCanvasAndPost(canvas); | 202 getHolder().unlockCanvasAndPost(canvas); |
| 203 | 203 |
| 204 synchronized (mAnimationLock) { | 204 getHandler().postAtTime(new Runnable() { |
|
Yuwei
2016/06/29 01:17:43
I'm not sure whether this is a good solution if it
Hzj_jie
2016/06/29 01:38:11
Done.
| |
| 205 if (mInputAnimationRunning) { | 205 @Override |
| 206 getHandler().postAtTime(new Runnable() { | 206 public void run() { |
| 207 @Override | 207 processAnimation(); |
| 208 public void run() { | |
| 209 processAnimation(); | |
| 210 } | |
| 211 }, startTimeMs + 30); | |
| 212 } | 208 } |
| 213 } | 209 }, startTimeMs + 30); |
| 214 } | 210 } |
| 215 | 211 |
| 216 private void processAnimation() { | 212 private void processAnimation() { |
| 217 boolean running; | 213 boolean running; |
| 218 synchronized (mAnimationLock) { | 214 synchronized (mAnimationLock) { |
| 219 running = mInputAnimationRunning; | 215 running = mInputAnimationRunning; |
| 220 } | 216 } |
| 221 if (running) { | 217 if (running) { |
| 222 mInputHandler.processAnimation(); | 218 mInputHandler.processAnimation(); |
| 223 requestRepaint(); | 219 requestRepaint(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 @Override | 320 @Override |
| 325 public void setAnimationEnabled(boolean enabled) { | 321 public void setAnimationEnabled(boolean enabled) { |
| 326 synchronized (mAnimationLock) { | 322 synchronized (mAnimationLock) { |
| 327 if (enabled && !mInputAnimationRunning) { | 323 if (enabled && !mInputAnimationRunning) { |
| 328 requestRepaint(); | 324 requestRepaint(); |
| 329 } | 325 } |
| 330 mInputAnimationRunning = enabled; | 326 mInputAnimationRunning = enabled; |
| 331 } | 327 } |
| 332 } | 328 } |
| 333 } | 329 } |
| OLD | NEW |