Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML5 canvas drawing problems with Chrome
    primarykey
    data
    text
    <p>I'm digging into HTML5 canvas a bit, and ran into something odd using my locally installed version of Chrome. It's Chrome 29 on linux.</p> <p>I was looking at the following (sample code from HTML5 Canvas, 2 ed):</p> <pre><code>//draw a big box on the screen context.fillStyle = "black"; context.fillRect(10, 10, 200, 200); context.save(); context.beginPath(); context.rect(0, 0, 50, 50); context.clip(); //red circle context.beginPath(); context.strokeStyle = "red"; context.lineWidth=5; context.arc(100, 100, 100, (Math.PI/180)*0, (Math.PI/180)*360, false); context.stroke(); context.closePath(); context.restore(); //reclip to the entire canvas context.beginPath(); context.rect(0, 0, 500, 500); context.clip(); //draw a blue line that is not clipped context.beginPath(); context.strokeStyle = "blue"; //need list of available colors context.lineWidth=5; context.arc(100, 100, 50, (Math.PI/180)*0, (Math.PI/180)*360, false); context.stroke(); context.closePath(); </code></pre> <p>And should get:</p> <p><img src="https://i.stack.imgur.com/M4TiO.png" alt="Correct"></p> <p>But instead see:</p> <p><img src="https://i.stack.imgur.com/TuPOG.png" alt="Incorrect"></p> <p>My research suggests that Chrome canvas is in a state of flux, and that arcs have had problems in the past. However, it seems to be fine on a close version of Chrome for Windows, and Chrome 27 on another linux desktop.</p> <p>I've looked through my Chrome://flags and don't see anything that should obviously effect this.</p> <p>Any guidance would be appreciated.</p> <p><strong>EDIT:</strong></p> <p><em>I've tried variations of #enable-experimental-canvas-features and #disable-accelerated-2d-canvas in chrome://flags without any luck.</em></p> <p><strong>Here's a Fiddle:</strong></p> <p><a href="http://jsfiddle.net/QJRHE/4/" rel="nofollow noreferrer">http://jsfiddle.net/QJRHE/4/</a></p> <p><strong>Another EDIT:</strong></p> <p>This code works on Chromium 28.0.1500.71 on my machine. I'm starting to suspect this is a Chrome bug.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload