beginFrame method
void
beginFrame()
Call this at the start of each frame (before render).
Implementation
void beginFrame() {
final now = _clock.elapsed;
if (!metricsOnlyFrame && _lastFrameElapsed != null) {
final frameTime = now - _lastFrameElapsed!;
_frameTimes[_frameTimeIndex] = frameTime;
_frameTimeIndex = (_frameTimeIndex + 1) % _sampleSize;
_frameTimeCount++;
}
// Only update the baseline timestamp for real frames so that the next
// real frame measures the gap from the previous real frame, not from
// the metrics-only render.
if (!metricsOnlyFrame) {
_lastFrameElapsed = now;
}
_renderStopwatch = Stopwatch()..start();
}