stays inside it
Three faults in Edit, all measured against pixels:
- Copy took the bounding rectangle of the selection, so Paste brought
back what a lasso had excluded. The clipboard is now RGB plus one
coverage byte per pixel (PasteBlend/SelectFromCover), not a pixmap,
which also blends a feathered edge and keeps both depths identical.
- Cut was MaskClear plus a full XFillRectangle: cutting a lasso wiped
the whole picture. It is now Copy followed by PaintMask, which is
mask-aware.
- Paste Into called PasteFromClip() with no limit and was a second
Paste; it now clips to the selection's coverage.
And one fault at the root: MaskFromRect() called MaskClear(), which
drops hasSel, after every caller had set hasSel = 1 -- so the marquee
produced a mask nothing believed in. Copy fell back to the whole
picture, Clear/Fill/Crop ignored the rectangle. MaskFromRect claims
the selection itself now, and no caller has to remember.
Evidence:
-cliptest PASS on depth 24 and depth 8: lasso hole kept through
Copy/Paste, cut-left/cut-right outside the band intact,
paste-into limited to the selection, soft paste blends,
a whole-picture clip stays opaque.
full run 24 green, 0 red (12 modes x 2 depths)
mouse dragged 60x60 box -> "dtphoto: copied 60x60";
Select > None, same Copy -> "dtphoto: copied 1024x768";
Edit > Cut -> "copied 60x60" then "cut";
Edit > Paste Into -> "pasted 60x60 into the selection"