282 // counter to be notified when a scene has been rendered. We
283 // could reduce the class count and indirection if we had a more
284 // direct method for notifying some performance tracker rather
285 // than going through this round-about way.
286 scene.frameRendered();
287
288 // Work to be done after all rendering is completed. Note that
289 // I check against "1" to indicate all rendering is done, and
290 // only decrement the allWorkCompletedLatch after wards. This is
291 // because as soon as I decrement the allWorkCompletedLatch to 0,
292 // then whatever code remains in this method will run concurrently
293 // with the FX app thread, and I'd prefer to minimize the number
294 // of things here that could be happening in parallel.
295 if (allWorkCompletedLatch.getCount() == 1) {
296 // In some cases we need to tell the toolkit that
297 // now would be a great time to vsync!
298 if (needsHint && !toolkit.hasNativeSystemVsync()) {
299 toolkit.vsyncHint();
300 }
301
302 Application.GetApplication().notifyRenderingFinished();
303
304 // If pulse logging is enabled, then we must call renderEnd now
305 // that we know that all of the scene's being rendered are finished
306 if (PULSE_LOGGING_ENABLED) {
307 PULSE_LOGGER.renderEnd();
308 }
309 }
310
311 // Count down the latch, indicating that drawing has
312 // completed for some scene.
313 allWorkCompletedLatch.countDown();
314 }
315
316 /**
317 * Run a full pulse and repaint before returning.
318 */
319 final void liveRepaintRenderJob(final ViewScene scene) {
320 ViewPainter viewPainter = scene.getPainter();
321 QuantumToolkit quantum = (QuantumToolkit)QuantumToolkit.getToolkit();
322 quantum.pulse(false);
|
282 // counter to be notified when a scene has been rendered. We
283 // could reduce the class count and indirection if we had a more
284 // direct method for notifying some performance tracker rather
285 // than going through this round-about way.
286 scene.frameRendered();
287
288 // Work to be done after all rendering is completed. Note that
289 // I check against "1" to indicate all rendering is done, and
290 // only decrement the allWorkCompletedLatch after wards. This is
291 // because as soon as I decrement the allWorkCompletedLatch to 0,
292 // then whatever code remains in this method will run concurrently
293 // with the FX app thread, and I'd prefer to minimize the number
294 // of things here that could be happening in parallel.
295 if (allWorkCompletedLatch.getCount() == 1) {
296 // In some cases we need to tell the toolkit that
297 // now would be a great time to vsync!
298 if (needsHint && !toolkit.hasNativeSystemVsync()) {
299 toolkit.vsyncHint();
300 }
301
302 Application application = Application.GetApplication();
303 if (application != null) {
304 application.notifyRenderingFinished();
305 }
306
307 // If pulse logging is enabled, then we must call renderEnd now
308 // that we know that all of the scene's being rendered are finished
309 if (PULSE_LOGGING_ENABLED) {
310 PULSE_LOGGER.renderEnd();
311 }
312 }
313
314 // Count down the latch, indicating that drawing has
315 // completed for some scene.
316 allWorkCompletedLatch.countDown();
317 }
318
319 /**
320 * Run a full pulse and repaint before returning.
321 */
322 final void liveRepaintRenderJob(final ViewScene scene) {
323 ViewPainter viewPainter = scene.getPainter();
324 QuantumToolkit quantum = (QuantumToolkit)QuantumToolkit.getToolkit();
325 quantum.pulse(false);
|