compositeFrom method

void compositeFrom(
  1. CellBuffer source,
  2. CellOffset destOffset
)

Paints source into this buffer with its top-left landing at destOffset, as if its content were painted here directly: every cell source painted lands, and every cell it left empty keeps what this buffer already holds (an ancestor's background, an earlier sibling). How a cached or scratch buffer is composited back — a repaint boundary's cache, a clipped viewport — much faster than re-walking the subtree's paint.

One case differs from painting directly: a cell source painted and then emptied itself (half of a wide glyph it later overwrote) cannot be told from one it never painted, so it keeps what lies beneath, where a direct paint would have left it empty.

Implementation

void compositeFrom(CellBuffer source, CellOffset destOffset) {
  _copyRect(
    source,
    0,
    0,
    source._size.cols,
    source._size.rows,
    destOffset,
    transparent: true,
  );
}