| 292 | _contentLayer->layoutIfNeeded(); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | TimePoint LayerRoot::updateFrameTime(TimePoint absoluteFrameTime) { |
| 297 | if (!_initialAbsoluteFrameTime) { |
| 298 | _initialAbsoluteFrameTime = {absoluteFrameTime}; |
| 299 | } |
| 300 | _lastAbsoluteFrameTime = {absoluteFrameTime}; |
| 301 | |
| 302 | return TimePoint((absoluteFrameTime - _initialAbsoluteFrameTime.value()).seconds()); |
| 303 | } |
| 304 | |
| 305 | TimePoint LayerRoot::getFrameTimeForAbsoluteFrameTime(TimePoint absoluteFrameTime) const { |
| 306 | if (!_initialAbsoluteFrameTime) { |
| 307 | return TimePoint(0.0); |
| 308 | } |
| 309 | |
| 310 | return TimePoint((absoluteFrameTime - _initialAbsoluteFrameTime.value()).seconds()); |
| 311 | } |
| 312 | |
| 313 | uint64_t LayerRoot::allocateLayerId() { |
| 314 | return ++_layerIdSequence; |
| 315 | } |
| 316 | |
| 317 | void LayerRoot::processFrame(TimePoint absoluteFrameTime) { |
| 318 | if (_destroyed) { |
| 319 | return; |
| 320 | } |
| 321 | |
| 322 | _processingFrame = true; |
| 323 | |
| 324 | VALDI_TRACE("SnapDrawing.processFrame"); |
| 325 | |
| 326 | auto frameTime = updateFrameTime(absoluteFrameTime); |
| 327 | |
| 328 | layoutIfNeeded(); |
| 329 | |
| 330 | { |
| 331 | VALDI_TRACE("SnapDrawing.flushEvents"); |
| 332 | refreshTouches(frameTime); |
| 333 | _eventQueue.flush(frameTime); |
| 334 | } |