From baf2af5971df1740ba3b8fbf30ff75cbebe600bd Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 19 Jul 2026 10:02:11 +0000 Subject: [PATCH 13/71] debug(macos): log atlas sample + tint alpha per blit (rev 7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precise ink analysis of the fresh 284x144 output shows the ONLY wrongly-blank cell on line 1 is cell 0 (the leading 'c') — everything else, including all of "macOS PowerPC", renders correctly with even spacing. So this is a first-tile bug, not a broad slicing/atlas problem. Log each blit's atlas sample (R,A at the tile's top-left) and the tint alpha at composite time, to see whether the first tile reads blank atlas or has zero tint. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01AeG2jwYMX5gdvvtUnx3PJa --- src/contour_macos/SoftwareRenderTarget.cpp | 18 ++++++++++++++++++ src/contour_macos/render_probe.cpp | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/contour_macos/SoftwareRenderTarget.cpp b/src/contour_macos/SoftwareRenderTarget.cpp index 0705d550..d197c2e8 100644 --- a/src/contour_macos/SoftwareRenderTarget.cpp +++ b/src/contour_macos/SoftwareRenderTarget.cpp @@ -338,6 +338,24 @@ void SoftwareRenderTarget::blitAtlasTile(RenderTile const& tile, std::optional(_output.width())); y1 = std::min(y1, static_cast(_output.height())); + if (_debugTiles) + { + // Probe the atlas pixel at the tile's top-left sample point, plus the tint, so we can + // see at composite time whether the sampled atlas region actually holds glyph ink and + // whether the tint alpha is non-zero. + auto const u0 = n.x + n.width * (0.5f / static_cast(targetW)); + auto const v0 = n.y + n.height * (0.5f / static_cast(targetH)); + FloatColor const t0 = sampleNearestClamp(_atlas, u0, v0); + std::fprintf(stderr, + " blit x0src=%d atlasSample@u=%.4f,v=%.4f -> R=%.2f A=%.2f tintA=%.2f\n", + x0src, + u0, + v0, + t0.r, + t0.a, + tint.a); + } + for (int py = y0; py < y1; ++py) { float const v = n.y + n.height * ((static_cast(py - y0src) + 0.5f) / static_cast(targetH)); diff --git a/src/contour_macos/render_probe.cpp b/src/contour_macos/render_probe.cpp index 14c44d1d..51cc13ad 100644 --- a/src/contour_macos/render_probe.cpp +++ b/src/contour_macos/render_probe.cpp @@ -59,7 +59,7 @@ void writePpm(std::string const& path, contour_macos::PixelBuffer const& buf) // produced it. __DATE__/__TIME__ update whenever THIS translation unit is recompiled, so the // printed line is a reliable "is the running binary built from the current source?" signal // without needing a full rebuild. -#define RENDER_PROBE_REVISION 6 +#define RENDER_PROBE_REVISION 7 int main(int argc, char** argv) {