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.
I was looking at the following (sample code from HTML5 Canvas, 2 ed):
//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();
And should get:
But instead see:
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.
I've looked through my Chrome://flags and don't see anything that should obviously effect this.
Any guidance would be appreciated.
EDIT:
I've tried variations of #enable-experimental-canvas-features and #disable-accelerated-2d-canvas in chrome://flags without any luck.
Here's a Fiddle:
Another EDIT:
This code works on Chromium 28.0.1500.71 on my machine. I'm starting to suspect this is a Chrome bug.