fix: close Θ-W7-T1 review — scaling guard, opacity claims, two vacuous test fixes

Guards the stroke blend against LICE_EXT_GET_SCALING, tightens the analytic-stroker's boxes and NaN handling, corrects the opaque-core threshold and inner-dial rationale in the docs, and re-derives two review-flagged tautological tests so they actually fail against the bugs they claim to catch.
This commit is contained in:
2026-08-01 13:45:43 -04:00
parent 2e09776342
commit 3fb77027c6
11 changed files with 181 additions and 30 deletions
+24
View File
@@ -16,6 +16,7 @@
#include "../src/core/instrument/engine/velocity_curve.h"
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
@@ -398,12 +399,35 @@ static void testSubpixelMapIsTheIntegerMapBeforeRounding() {
const Box boxes[] = {{10, 20, 100, 51}, {0, 0, 127, 101}, {7, 3, 33, 17}};
for (const Box& box : boxes) {
for (const VelocityCurve& c : {uni(), bip()}) {
const double lo = curveYMin(c.domain());
for (double v = 0.0; v <= 127.0; v += 1.0) {
for (double a = -1.0; a <= 1.0; a += 0.125) {
const auto ip = c.pixelFromPoint(box, {v, a});
const auto fp = c.subpixelFromPoint(box, {v, a});
// Relationship guard: int IS round(subpixel), everywhere — a forward guard
// against the trace drifting off its own handles. This alone is a tautology
// against the CURRENT formula (int literally computes this expression), so
// it cannot catch a regression against the PRE-subpixel formula below.
CHECK(ip.x == box.left + static_cast<int>(fp.x - box.left + 0.5));
CHECK(ip.y == box.top + static_cast<int>(fp.y - box.top + 0.5));
// Independent re-derivation of the formula the int map claims to reproduce —
// box.left + (int)(frac*w + 0.5) — computed here from scratch rather than
// through subpixelFromPoint's box.left-add-then-subtract round trip, so a
// flip introduced by that round trip (however unlikely per Sterbenz) has
// something to fail against.
const double vClamped = (std::min)(kVelMax, (std::max)(kVelMin, v));
const double fracX = (vClamped - kVelMin) / (kVelMax - kVelMin);
const int oldX =
box.left + static_cast<int>(fracX * static_cast<double>(box.width) + 0.5);
CHECK(ip.x == oldX);
const double aClamped = (std::min)(kCurveYMax, (std::max)(lo, a));
const double fracY = (aClamped - lo) / (kCurveYMax - lo);
const int oldY =
box.top + static_cast<int>((1.0 - fracY) *
static_cast<double>(box.height - 1) + 0.5);
CHECK(ip.y == oldY);
}
}
}