Re: [whatwg] CanvasRenderingContext2D with addPath, currentPath

On Nov 5, 2013, at 00:17 , Dean Jackson <dino@apple.com> wrote:

> ctx.currentPath != ctx.currentPath

Instead of using getCurrentPath and setCurrentPath methods as a solution, this could perhaps be solved by returning the internal path instead of a copy, but with a flag that would prevent further alterations on it.

The setter of the currentPath accessor / data member could then make the copy instead when a new path is to be set.

This would also make sense from a a caching point of view, where storing the currentPath for caching might not actually mean that it will be used again in the future (e.g. because the path's geometry changes completely on each frame of an animation), so copying only when setting would postpone the actual work of having to make the copy, and would help memory consummation and performance.

I'm not sure what I suggest here makes sense from the browser vendor point of view, if so please apologize my naivety in this respect.

Received on Friday, 6 December 2013 12:39:14 UTC