NEW 223799
Lines rendered to canvas element with more than 256 points are rendered incorrectly
https://bugs.webkit.org/show_bug.cgi?id=223799
Summary Lines rendered to canvas element with more than 256 points are rendered incor...
James White
Reported 2021-03-26 08:48:11 PDT
Created attachment 424361 [details] two lines drawn on canvas, the bottom line has 267 points Lines rendered to canvas element with more than 256 points are rendered incorrectly. If I render a single line with 256 points the line renders as expected. If I render a single line with more than 256 points the line is broken into two or more separate lines. The following JS fiddle shows two lines, the top line has 256 points, the bottom line has 257 points. They are otherwise identical. The bottom one consistently renders in 3 parts on ipad. https://jsfiddle.net/g26t8adL/2/ For clarity, the code to reproduce is below HTML: <canvas id="c"></canvas> JS: (function() { // prep canvas let canvas = document.getElementById('c') let ctx = canvas.getContext('2d') canvas.width = 700 canvas.height = 300 // prep stroke ctx.globalAlpha = 0.5 ctx.lineWidth = 30 ctx.lineJoin = ctx.lineCap = 'round' // draw 256 point on canvas ctx.beginPath() for(let i=0; i< 256; i++){ ctx.lineTo((50+(i*2)), 100) } ctx.stroke() // draw 257 point on canvas ctx.beginPath() for(let i=0; i< 257; i++){ ctx.lineTo((50+(i*2)), 200) } ctx.stroke() })();
Attachments
two lines drawn on canvas, the bottom line has 267 points (33.74 KB, image/png)
2021-03-26 08:48 PDT, James White
no flags
rendering in safari, firefox, chrome (293.72 KB, image/png)
2024-08-22 20:16 PDT, Karl Dubost
no flags
Radar WebKit Bug Importer
Comment 1 2021-03-26 16:56:22 PDT
Ahmad Saleem
Comment 2 2024-08-14 06:12:03 PDT
It is still reproducible with Safari 18 Beta while Chrome Canary 129 and Firefox Nightly 131 match each other.
Karl Dubost
Comment 3 2024-08-22 20:16:09 PDT
Created attachment 472274 [details] rendering in safari, firefox, chrome Safari Technology Preview 201 20620.1.2 Firefox Nightly 131.0a1 13124.8.21 Google Chrome Canary 130.0.6672.0 6672.0
Note You need to log in before you can comment on or make changes to this bug.