Skip to content

Commit bb54393

Browse files
committed
fixed casting
1 parent 1374b29 commit bb54393

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

core/src/processing/core/PSurfaceAndroid2D.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,12 @@ public void run() {
257257
private void scheduleNextDraw() {
258258
handler.removeCallbacks(drawRunnable);
259259
component.requestDraw();
260-
int waitMillis = 1000 / 15;
260+
int targetMillis = 1000 / 15;
261261
if (sketch != null) {
262-
final PSurfaceGLES glsurf = (PSurfaceGLES) sketch.surface;
263-
float targetfps = glsurf.pgl.getFrameRate();
264-
float targetMillisPerFrame = 1000 / targetfps;
265-
266-
// float actualFps = sketch.frameRate;
267-
// float actualMillisPerFrame = 1000 / actualFps;
268-
// int waitMillis = (int)PApplet.max(0, targetMillisPerFrame - actualMillisPerFrame);
269-
waitMillis = (int) targetMillisPerFrame;
262+
targetMillis = (int)(1000 / sketch.frameRateTarget);
270263
}
271264
if (component.canDraw()) {
272-
handler.postDelayed(drawRunnable, waitMillis);
265+
handler.postDelayed(drawRunnable, targetMillis);
273266
}
274267
}
275268

core/src/processing/opengl/PSurfaceGLES.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,19 +289,14 @@ public void run() {
289289
private void scheduleNextDraw() {
290290
handler.removeCallbacks(drawRunnable);
291291
component.requestDraw();
292-
int waitMillis = 1000 / 15;
292+
int targetMillis = 1000 / 15;
293293
if (sketch != null) {
294294
final PSurfaceGLES glsurf = (PSurfaceGLES) sketch.surface;
295295
float targetfps = glsurf.pgl.getFrameRate();
296-
float targetMillisPerFrame = 1000 / targetfps;
297-
298-
// float actualFps = sketch.frameRate;
299-
// float actualMillisPerFrame = 1000 / actualFps;
300-
// int waitMillis = (int)PApplet.max(0, targetMillisPerFrame - actualMillisPerFrame);
301-
waitMillis = (int) targetMillisPerFrame;
296+
targetMillis = (int)(1000 / targetfps);
302297
}
303298
if (component.canDraw()) {
304-
handler.postDelayed(drawRunnable, waitMillis);
299+
handler.postDelayed(drawRunnable, targetMillis);
305300
}
306301
}
307302

0 commit comments

Comments
 (0)