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.app.ActionBar; | 7 import android.app.ActionBar; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
10 import android.graphics.Canvas; | 10 import android.graphics.Canvas; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 * cause the UI to lag. Specifically, it is currently invoked on the native | 76 * cause the UI to lag. Specifically, it is currently invoked on the native |
77 * graphics thread using a JNI. | 77 * graphics thread using a JNI. |
78 */ | 78 */ |
79 @Override | 79 @Override |
80 public void run() { | 80 public void run() { |
81 if (Looper.myLooper() == Looper.getMainLooper()) { | 81 if (Looper.myLooper() == Looper.getMainLooper()) { |
82 Log.w("deskview", "Canvas being redrawn on UI thread"); | 82 Log.w("deskview", "Canvas being redrawn on UI thread"); |
83 } | 83 } |
84 | 84 |
85 Bitmap image = JniInterface.getVideoFrame(); | 85 Bitmap image = JniInterface.getVideoFrame(); |
| 86 if (image == null) { |
| 87 // This can happen if the client is connected, but a complete video
frame has not yet |
| 88 // been decoded. |
| 89 return; |
| 90 } |
86 | 91 |
87 int width = image.getWidth(); | 92 int width = image.getWidth(); |
88 int height = image.getHeight(); | 93 int height = image.getHeight(); |
89 boolean sizeChanged = false; | 94 boolean sizeChanged = false; |
90 synchronized (mRenderData) { | 95 synchronized (mRenderData) { |
91 if (mRenderData.imageWidth != width || mRenderData.imageHeight != he
ight) { | 96 if (mRenderData.imageWidth != width || mRenderData.imageHeight != he
ight) { |
92 // TODO(lambroslambrou): Move this code into a sizeChanged() cal
lback, to be | 97 // TODO(lambroslambrou): Move this code into a sizeChanged() cal
lback, to be |
93 // triggered from JniInterface (on the display thread) when the
remote screen size | 98 // triggered from JniInterface (on the display thread) when the
remote screen size |
94 // changes. | 99 // changes. |
95 mRenderData.imageWidth = width; | 100 mRenderData.imageWidth = width; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 @Override | 224 @Override |
220 public void showKeyboard() { | 225 public void showKeyboard() { |
221 // TODO(lambroslambrou): Implement this. | 226 // TODO(lambroslambrou): Implement this. |
222 } | 227 } |
223 | 228 |
224 @Override | 229 @Override |
225 public void transformationChanged() { | 230 public void transformationChanged() { |
226 requestRepaint(); | 231 requestRepaint(); |
227 } | 232 } |
228 } | 233 } |
OLD | NEW |