Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@
},
"devDependencies": {
"@conventional-commits/parser": "^0.4.1",
"katex": "^0.18.1"
"katex": "^0.19.1"
}
}
11 changes: 8 additions & 3 deletions test/stroke-joins.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,14 @@ test('and the whole square is symmetric, at every width and join', async () => {
square(ctx);
});
const { worst, where } = asymmetry(at);
// 1 is antialiasing rounding on the two axes; a missing join is a
// whole corner, which reads as 255 minus its edge coverage
assert.ok(worst <= 1, `${join} lineWidth ${lw}: asymmetry ${worst} at ${where}`);
// An odd width puts the edges on half pixels, and RENDER's Precise
// grid samples a pixel 17 columns by 15 rows: a half-covered pixel
// reads 119 or 136 along a horizontal edge, 120 or 135 along a
// vertical one, so the quarter turn costs up to 16 levels. XQuartz
// and node-x11's own server since 4.3.0 both give exactly that. A
// missing join is a whole corner: at least 71 levels at lineWidth 1,
// 255 from 2 up.
assert.ok(worst <= 16, `${join} lineWidth ${lw}: asymmetry ${worst} at ${where}`);
}
}
});
Expand Down
9 changes: 6 additions & 3 deletions test/xserver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,16 +778,19 @@ test('protocol: AddTraps accumulates antialiased coverage', async () => {
Render.CreatePicture(picId, pid, Render.a8);
Render.FillRectangles(Render.PictOp.Src, picId, [0, 0, 0, 0], [0, 0, 8, 8]);

// half-pixel-tall full-width span: expect ~50% coverage on row 2, and two
// adds on the same span must accumulate to ~100%
// half-pixel-tall full-width span: about half coverage on row 2, and two
// more adds on the same span must accumulate to full coverage
const span = [0, 8, 2, 0, 8, 2.5]; // top l/r/y, bottom l/r/y
Render.AddTraps(picId, 0, 0, span);
const one = await new Promise((resolve, reject) =>
X.GetImage(2, pid, 0, 0, 8, 8, 0xffffffff, (err, res) => (err ? reject(err) : resolve(res)))
);
// depth-8 GetImage: one byte per pixel, rows padded to 4 (8 is aligned)
const alphaAt = (img, x, y) => img.data[y * 8 + x];
near(alphaAt(one, 4, 2), 128, 6, 'half-covered row');
// RENDER's Precise grid for a8 is 17 samples by 15 rows, the rows at
// 1/30 + k/15 of the pixel; the top half holds 7 of them, and 7 × 17 =
// 119. pixman servers give exactly this, as node-x11's has since 4.3.0.
assert.equal(alphaAt(one, 4, 2), 119, 'half-covered row');
assert.equal(alphaAt(one, 4, 3), 0, 'row below untouched');

Render.AddTraps(picId, 0, 0, span);
Expand Down
Loading