Animation-only frames repaint the whole window

Open
#1,497 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start with the linked change in krazyjakee/blitz commit 959fc445, then read the anyrender damage API issue #149 and Stylo stepped animations issue #517. The issue names BaseDocument::paint_damage, blitz_paint::paint_scene_damaged, and next_animation_change as relevant entry points. Done means animation-only frames repaint only the previous and current animation damage, unchanged frames are skipped, paused animations are not restyled, and other frame causes still repaint everything.

Written by the indexing model from the issue text.

Description

A-Animation A-Paint C-Performance

Every frame caused only by a running animation repaints the whole window. A small status spinner at 60 Hz then costs about as much as a full-window redraw on every frame: in our measurements nearly half a core on a desktop GPU with vello_hybrid, and far more with a CPU renderer. #1309 covers the related pacing problem, and #1197 lists the same full repaint for wheel scrolling.

A change we carry, in case it's useful as a starting point: https://github.com/krazyjakee/blitz/commit/959fc445. It needs a damage API in anyrender (DioxusLabs/anyrender#149) and a Stylo hook for stepped animations (servo/stylo#517).

  • A frame whose only cause is an animation tick repaints only the union of where the animating elements painted before and where they paint now. BaseDocument::paint_damage and blitz_paint::paint_scene_damaged clip the scene to it.
  • Frames with no visible change are skipped.
  • Paused animations are no longer restyled.
  • steps() animations sleep until their next step (next_animation_change).
  • Any other cause of a frame still repaints everything, so it fails safe.

Measured on a 1440×900 window, a continuously turning status-bar spinner went from 46.9% to 8.2% of a core, and an 8-step one to 1.85%.

Dominant language
Rust
Stars
4.5k
Forks
281
Avg merge
6h 6m
Merged PRs (30d)
184

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DioxusLabs/blitz

All issues in DioxusLabs/blitz

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.