Skip to main content

Module framing

Module framing 

Source
Expand description

The framed presentation canvas of one reconstructed canvas (docs/ARCHITECTURE.md §十 “呈现画布”): the reference frame’s native chrome around the reconstructed content, with flat background bands where the content is taller or wider than the pane it was seen through. No toolbar is translated into world coordinates, no sidebar icon is stretched or repeated, and background extensions never count as observed evidence.

FramingSession builds one framed canvas as a resumable job over the tile cache. Its cost is O(perimeter tiles plus observed source tiles), never O(bounding-box area / tile²): before touching an output tile it plans, with grid arithmetic only, the tiles that can be non-empty — those that reach outside the content rect (chrome and background bands, kept so the frame stays continuous) and those under at least one observed source tile — and refuses a plan of more than max_tiles tiles before any tile work starts.

The host answers what each FramingSession::step asks for: the reference frame (Step::NeedReference), the source canvas’s level-0 tile index (Step::NeedIndex, asked only once the perimeter alone fits the limit), and tiles that are not resident (Step::NeedTile: make room with TileCache::victim, storing what is dirty before TileCache::evict, then TileCache::insert). Step::Next starts each output tile and is where the host checks for pause and stop; Step::Save hands back an output tile that received pixels, for the host to store now. Per output tile the session takes the output tile first, then the source tiles under it, row by row, each touched in the cache or asked for, so the cache sees the same sequence of uses as it always has.

Structs§

FramedCanvas
A framed canvas the session built: its id and size, where the content sits, and the counters it recomputed from the pixels it copied.
FramingSession
One framed canvas in progress.
Reference
The reference frame the chrome is copied from, decoded by the host.
SourceCanvas
What the session needs to know about the canvas it frames.

Enums§

FramingError
Outcome
SaveTile
An output tile to store now.
Step

Constants§

DEFAULT_MAX_TILES
Planned output tiles a framed canvas may have before it is skipped.

Functions§

intersect
Intersection of the pane with its crop, or of an output tile with the content.