[whatwg] CanvasRenderingContext2D with addPath, currentPath
cabanier at gmail.com
Mon Dec 16 20:34:38 PST 2013
On Fri, Dec 6, 2013 at 4:38 AM, Jürg Lehni <lists at scratchdisk.com> wrote:
> 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.
yes, this is an optimization that a browser vendor could make. Since this
is all behind the scenes, there is no need to define anything in the canvas
More information about the whatwg