Skip to main content

Module temporal

Module temporal 

Source
Expand description

Temporal-conflict compositing: pure algorithms behind Compositor (src/core/compositor.ts) that do not themselves touch KV storage. components, the pixel-write half of overwritePatch (overwrite_tile), the in-memory temporal index (TemporalIndex) and resolveTemporal’s decision (TemporalIndex::decide + mask_complete + TemporalIndex::commit) all live here (see docs/ARCHITECTURE.md §十 “合成与瞬态像素” for the invariants they keep — complete means “rewrote every previously covered pixel of the block”, maskComplete is all-or-nothing over the whole connected component, frozen blocks still heal provisional pixels).

Structs§

CommitOut
Component
One 8-connected component of conflicting size-px blocks: its bounding rect in native pixels, and every block absolute coordinate that belongs to it (never just the bounding box — a concave, e.g. L-shaped, conflict must not drag a pixel-identical block in its bounding box into the patch).
OverwriteStats
OverwriteTile
Mutable view of the tile buffers overwrite_tile touches. frozen is written here (unlike compositor::TileBuffers, where composite_tile only ever reads it) because overwritePatch sets it under the ‘stable’ policy.
TemporalIndex
TemporalRecord
One in-memory temporal record (ResidentTemporal in src/core/compositor.ts — blocks there is the persisted, derived-on-write form of keys here).

Constants§

QUALITY_BLOCK

Functions§

components
Mirrors Compositor.components (src/core/compositor.ts): 8-connected components of cells, absolute block coordinates. cells must already be in the caller’s chosen seed order (TS sorts by tile-then-local-block order before calling); a HashSet has no ordering guarantee, so a component’s seed is the first cells entry not yet claimed by an earlier component, walked in that same order — matching cells.values().next().value on a Set built from the same sorted array. Within a component, block order does not affect the result (the caller only ever treats it as a set).
mask_complete
The pixel-level completeness walk from resolveTemporal (src/core/compositor.ts): every pixel of every write_blocks block must fall inside the region (labels[y*atlas_width+x] == code, treating out-of-bounds as not contained), be unoccluded, and — when a consistency mask is given — be flagged consistent. All-or- nothing: the first failing pixel stops the walk (mirrors the original’s early-exit maskComplete flag; no side effects happen in the loop besides that flag, so early-exit and scan-to-completion agree).
overwrite_tile
Mirrors Compositor.overwritePatch’s per-tile inner loop (src/core/compositor.ts): unconditionally copies every pixel of blocks (absolute block coordinates already restricted to this tile) from rgba into the tile, marking coverage, healing any provisional bit, and bumping owner/quality/conflicts/frozen evidence. The caller (resolveTemporal) has already proven the whole written set world-consistent (maskComplete) before calling this, so every pixel here is guaranteed in-bounds — this mirrors, not re-derives, that guarantee.

Type Aliases§

DirtyRow
One dirty record ready to persist: its current content plus its block set in persisted (ascending (by, bx)) order.