@@ -252,31 +252,22 @@ impl RenderThread {
252
252
// Handle initial control messages
253
253
self . handle_control_messages ( ) ;
254
254
255
- // Fast path when
256
- // - no suspensions scheduled
257
- // - no script processor (so no event handling needed during rendering)
258
- if suspend_callbacks. is_empty ( ) {
259
- for _ in 0 ..num_frames {
260
- self . render_offline_quantum ( & mut buffer) ;
255
+ for quantum in 0 ..num_frames {
256
+ // Suspend at given times and run callbacks
257
+ if suspend_callbacks. first ( ) . map ( |& ( q, _) | q) == Some ( quantum) {
258
+ let callback = suspend_callbacks. remove ( 0 ) . 1 ;
259
+ ( callback) ( context) ;
260
+
261
+ // Handle any control messages that may have been submitted by the callback
262
+ self . handle_control_messages ( ) ;
261
263
}
262
- } else {
263
- for quantum in 0 ..num_frames {
264
- // Suspend at given times and run callbacks
265
- if suspend_callbacks. first ( ) . map ( |& ( q, _) | q) == Some ( quantum) {
266
- let callback = suspend_callbacks. remove ( 0 ) . 1 ;
267
- ( callback) ( context) ;
268
-
269
- // Handle any control messages that may have been submitted by the callback
270
- self . handle_control_messages ( ) ;
271
- }
272
264
273
- self . render_offline_quantum ( & mut buffer) ;
265
+ self . render_offline_quantum ( & mut buffer) ;
274
266
275
- let events_were_handled = event_loop. handle_pending_events ( ) ;
276
- if events_were_handled {
277
- // Handle any control messages that may have been submitted by the handler
278
- self . handle_control_messages ( ) ;
279
- }
267
+ let events_were_handled = event_loop. handle_pending_events ( ) ;
268
+ if events_were_handled {
269
+ // Handle any control messages that may have been submitted by the handler
270
+ self . handle_control_messages ( ) ;
280
271
}
281
272
}
282
273
0 commit comments