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§
- Commit
Out - 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). - Overwrite
Stats - Overwrite
Tile - Mutable view of the tile buffers
overwrite_tiletouches.frozenis written here (unlikecompositor::TileBuffers, wherecomposite_tileonly ever reads it) becauseoverwritePatchsets it under the ‘stable’ policy. - Temporal
Index - Temporal
Record - One in-memory temporal record (
ResidentTemporalin src/core/compositor.ts —blocksthere is the persisted, derived-on-write form ofkeyshere).
Constants§
Functions§
- components
- Mirrors
Compositor.components(src/core/compositor.ts): 8-connected components ofcells, absolute block coordinates.cellsmust already be in the caller’s chosen seed order (TS sorts by tile-then-local-block order before calling); aHashSethas no ordering guarantee, so a component’s seed is the firstcellsentry not yet claimed by an earlier component, walked in that same order — matchingcells.values().next().valueon aSetbuilt 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 everywrite_blocksblock 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-exitmaskCompleteflag; 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 ofblocks(absolute block coordinates already restricted to this tile) fromrgbainto 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§
- Dirty
Row - One dirty record ready to persist: its current content plus its block set in persisted (ascending (by, bx)) order.