OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 return size; | 304 return size; |
305 } | 305 } |
306 } | 306 } |
307 | 307 |
308 // View layout interface. | 308 // View layout interface. |
309 @Override | 309 @Override |
310 protected void onMeasure(int widthSpec, int heightSpec) { | 310 protected void onMeasure(int widthSpec, int heightSpec) { |
311 synchronized (layoutLock) { | 311 synchronized (layoutLock) { |
312 this.widthSpec = widthSpec; | 312 this.widthSpec = widthSpec; |
313 this.heightSpec = heightSpec; | 313 this.heightSpec = heightSpec; |
| 314 final Point size = getDesiredLayoutSize(); |
| 315 setMeasuredDimension(size.x, size.y); |
314 } | 316 } |
315 final Point size = getDesiredLayoutSize(); | |
316 setMeasuredDimension(size.x, size.y); | |
317 } | 317 } |
318 | 318 |
319 @Override | 319 @Override |
320 protected void onLayout(boolean changed, int left, int top, int right, int bot
tom) { | 320 protected void onLayout(boolean changed, int left, int top, int right, int bot
tom) { |
321 synchronized (layoutLock) { | 321 synchronized (layoutLock) { |
322 layoutWidth = right - left; | 322 layoutWidth = right - left; |
323 layoutHeight = bottom - top; | 323 layoutHeight = bottom - top; |
324 } | 324 } |
325 // Might have a pending frame waiting for a layout of correct size. | 325 // Might have a pending frame waiting for a layout of correct size. |
326 runOnRenderThread(renderFrameRunnable); | 326 runOnRenderThread(renderFrameRunnable); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 if (framesReceived > 0 && framesRendered > 0) { | 509 if (framesReceived > 0 && framesRendered > 0) { |
510 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; | 510 final long timeSinceFirstFrameNs = System.nanoTime() - firstFrameTimeNs; |
511 Logging.d(TAG, "Duration: " + (int) (timeSinceFirstFrameNs / 1e6) + | 511 Logging.d(TAG, "Duration: " + (int) (timeSinceFirstFrameNs / 1e6) + |
512 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs)
; | 512 " ms. FPS: " + (float) framesRendered * 1e9 / timeSinceFirstFrameNs)
; |
513 Logging.d(TAG, "Average render time: " | 513 Logging.d(TAG, "Average render time: " |
514 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); | 514 + (int) (renderTimeNs / (1000 * framesRendered)) + " us."); |
515 } | 515 } |
516 } | 516 } |
517 } | 517 } |
518 } | 518 } |
OLD | NEW |