Skip to content

Commit 4b3efd5

Browse files
committed
Round all the sizes
1 parent 77c3872 commit 4b3efd5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

content/index/dithering.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const setupDitherFor = (elm, img) => {
1414
const newWidth = Math.round(rect.width)
1515
if (newWidth == width || newWidth <= 0) return
1616
width = newWidth
17-
const height = width * aspect | 0
18-
const dpr = Math.min(window.devicePixelRatio, 2)
19-
const w = canvas.width = width * dpr
20-
const h = canvas.height = height * dpr
17+
const height = Math.round(width * aspect)
18+
const dpr = Math.min(Math.round(window.devicePixelRatio) || 1, 2)
19+
const w = canvas.width = Math.round(width * dpr)
20+
const h = canvas.height = Math.round(height * dpr)
2121
canvas.style.width = width + "px"
2222
ctx.drawImage(img, 0, 0, w, h)
2323

0 commit comments

Comments
 (0)