Lines are drawn every 10 canvas units (red lines every 50 units), but the canvas is scaled. Move the mouse and compare the results. Note that taking scrolling into account result in wrong positions when the window is scrolled.