From 3619fb943a635c5528cba37adf32770023056597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=96=E6=A2=81?= <418094911@qq.com> Date: Thu, 14 Aug 2014 17:07:04 +0800 Subject: [PATCH] mLastTickInNanoSeconds is the renderStart because: this.mLastTickInNanoSeconds = renderEnd - renderInterval; renderInterval = renderEnd - renderStart so: this.mLastTickInNanoSeconds = renderEnd - ( renderEnd - renderStart ); so: this.mLastTickInNanoSeconds = renderStart ; so: no need nanoTime() twice --- .../android/java/src/org/cocos2dx/lib/Cocos2dxRenderer.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxRenderer.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxRenderer.java index 14cb7739c6..89752bae2a 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxRenderer.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxRenderer.java @@ -100,11 +100,8 @@ public class Cocos2dxRenderer implements GLSurfaceView.Renderer { /* * Render time MUST be counted in, or the FPS will slower than appointed. */ - final long renderStart = System.nanoTime(); + this.mLastTickInNanoSeconds = System.nanoTime(); Cocos2dxRenderer.nativeRender(); - final long renderEnd = System.nanoTime(); - final long renderInterval = renderEnd - renderStart; - this.mLastTickInNanoSeconds = renderEnd - renderInterval; } }