https://gitlab.synchro.net/main/sbbs/-/commit/ffc18d44917d73447f2ed3fd
Added Files:
src/doors/termgfx/dirty.c dirty.h
Modified Files:
src/doors/syncretro/CMakeLists.txt syncretro_dirty.c src/doors/termgfx/CMakeLists.txt termgfx_termio.c
Log Message:
termgfx: one dirty-rect diff for syncretro and termgfx_termio
The patch path was written twice and maintained twice. Both doors mark a
cell grid from two index planes, label 4-connected components, merge boxes
that nearly touch, and give up when patching stops paying -- with the same shape, the same failure modes, and constants that differ only because
their grids do.
Twice meant every defect had to be found twice. A box against the frame
bottom that cannot cover its own changed rows was fixed in syncretro in
July and found again in termgfx_termio weeks later, where it cost 98% of
one session's full frames. A palette change that moves what a cell MEANS without moving its indices needed the same stale-index mask written into
each. syncconquer has a third copy, with DR_MAX_COMPONENTS/DR_MERGE_GAP/ DR_FALLBACK_PCT identical to termgfx_termio's.
dirty.h takes the half that is genuinely common: everything up to a set of boxes in GRID coordinates, parameterised by the grid, the merge gap and the budgets. What it deliberately does NOT take is the mapping from cell boxes
to display pixels, because the doors disagree about it for a real reason -- syncretro diffs the ALREADY-SCALED frame on the terminal's own cell grid,
so its boxes are placeable as they come, while termgfx_termio diffs the
native 320x200 on a fixed 16px tile grid and maps through its scaler, so it must snap afterwards. Each keeps its own mapping, its own alignment rules,
and the failure modes that belong to them (syncretro's bandfit, this
file's strand).
syncretro_dirty.c drops from 416 lines to 194 and termgfx_termio loses 127, against 394 lines of shared module -- roughly break-even in total, which is
not the point: the logic now exists once.
One behaviour change falls out. termgfx_termio's boxes were returned in whatever order the merge left them; they now come back top-to-bottom, left-to-right like syncretro's always have. The boxes never overlap, so
order cannot affect the result, but a deterministic one is easier to read
on the wire and in a trace.
syncconquer is untouched. Its copy is shaped to fit this interface, but it
is a door this change cannot exercise, and converting it blind is how a
shared module earns a reputation.
Co-Authored-By: Claude Opus 5 (1M context) <
noreply@anthropic.com>
--- SBBSecho 3.37-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)