not quite sure about the g.beginPath()
and the stroke state?
does it like the OpenGL's state if you do not change it will keep it state?