mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-12 21:23:02 +00:00
Each pixel of a decoded layer was widened to a freshly allocated Vec<f64>, divided, clamped and rounded through libm. The channels are now interleaved directly: 8-bit RGBA and grey are plain copies (x / 255 * 255 rounds back to x), 16-bit goes through a 64 Ki table and CMYK through a table over (c, k), both built from the same f64 expressions, so the bytes are identical. Tile copies into a plane use one slice copy or fill per row instead of a closure per byte. The scratch charged to the pixel budget is unchanged. Tests keep the old conversion and compare it exhaustively (every byte, every 16-bit value, every CMYK colour/black pair) and the old byte copy against the row copy for many crops. Part of #9412 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>