[whatwg] CanvasRenderingContext2D with addPath, currentPath

Jürg Lehni lists at scratchdisk.com
Fri Dec 6 04:38:46 PST 2013


On Nov 5, 2013, at 00:17 , Dean Jackson <dino at 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.




More information about the whatwg mailing list