1,295
edits
No edit summary |
|||
| Line 51: | Line 51: | ||
=== Scheduling Updates === | === Scheduling Updates === | ||
Let the desired frame rate be H Hz. Let the | Let the desired frame rate be H Hz. Let the timestamp of the start of the last update be S (initially 0). Let the current timestamp be Now(). There is always at most one pending update. Updates are scheduled as follows: | ||
* RequestImmediateUpdate() sets a flag mImmediateUpdate to true. It schedules an update for Now() (cancelling any later scheduled update). | * RequestImmediateUpdate() sets a flag mImmediateUpdate to true. It schedules an update for Now() (cancelling any later scheduled update). | ||
* On an RequestUpdate(), Invalidate() or Scroll() call, if there is currently no update scheduled, schedule one for max(Now(), | * On an RequestUpdate(), Invalidate() or Scroll() call, if there is currently no update scheduled, schedule one for max(Now(), S + 1/H). (I.e., make the update happen as soon as possible, except that we want it to render no earlier than 1/H seconds since the last update) --- except that if mImmediateUpdate is true, then always schedule an update for Now(). | ||
* After a window update, set mImmediateUpdate to false. If there are still active animations, schedule another update for | * After a window update, set mImmediateUpdate to false. If there are still active animations, schedule another update for max(Now(), S + 1/H). | ||
For hidden windows, we should never perform updates at all. Showing a window forces an immediate update. | For hidden windows, we should never perform updates at all. Showing a window forces an immediate update. | ||
edits